bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2012 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | |
| 9 | #include "GrGLCaps.h" |
robertphillips@google.com | 6177e69 | 2013-02-28 20:16:25 +0000 | [diff] [blame] | 10 | #include "GrGLContext.h" |
bsalomon@google.com | c9668ec | 2012-04-11 18:16:41 +0000 | [diff] [blame] | 11 | #include "SkTSearch.h" |
bsalomon@google.com | 20f7f17 | 2013-05-17 19:05:03 +0000 | [diff] [blame] | 12 | #include "SkTSort.h" |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 13 | |
| 14 | GrGLCaps::GrGLCaps() { |
| 15 | this->reset(); |
| 16 | } |
| 17 | |
| 18 | void GrGLCaps::reset() { |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 19 | INHERITED::reset(); |
| 20 | |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 21 | fVerifiedColorConfigs.reset(); |
| 22 | fStencilFormats.reset(); |
| 23 | fStencilVerifiedColorConfigs.reset(); |
| 24 | fMSFBOType = kNone_MSFBOType; |
bsalomon@google.com | 6b0cf02 | 2013-05-03 13:35:14 +0000 | [diff] [blame] | 25 | fFBFetchType = kNone_FBFetchType; |
commit-bot@chromium.org | 52ffbf6 | 2014-04-02 16:19:33 +0000 | [diff] [blame] | 26 | fInvalidateFBType = kNone_InvalidateFBType; |
krajcevski | 3217c4a | 2014-06-09 09:10:04 -0700 | [diff] [blame^] | 27 | fLATCAlias = kLATC_LATCAlias; |
commit-bot@chromium.org | 160b478 | 2014-05-05 12:32:37 +0000 | [diff] [blame] | 28 | fMapBufferType = kNone_MapBufferType; |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 29 | fMaxFragmentUniformVectors = 0; |
bsalomon@google.com | 60da417 | 2012-06-01 19:25:00 +0000 | [diff] [blame] | 30 | fMaxVertexAttributes = 0; |
commit-bot@chromium.org | a15f7e5 | 2013-06-05 23:29:25 +0000 | [diff] [blame] | 31 | fMaxFragmentTextureUnits = 0; |
commit-bot@chromium.org | 46fbfe0 | 2013-08-30 15:52:12 +0000 | [diff] [blame] | 32 | fMaxFixedFunctionTextureCoords = 0; |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 33 | fRGBA8RenderbufferSupport = false; |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 34 | fBGRAIsInternalFormat = false; |
| 35 | fTextureSwizzleSupport = false; |
| 36 | fUnpackRowLengthSupport = false; |
| 37 | fUnpackFlipYSupport = false; |
| 38 | fPackRowLengthSupport = false; |
| 39 | fPackFlipYSupport = false; |
| 40 | fTextureUsageSupport = false; |
| 41 | fTexStorageSupport = false; |
robertphillips@google.com | 443e5a5 | 2012-04-30 20:01:21 +0000 | [diff] [blame] | 42 | fTextureRedSupport = false; |
bsalomon@google.com | e76b7cc | 2012-06-18 12:47:06 +0000 | [diff] [blame] | 43 | fImagingSupport = false; |
robertphillips@google.com | 1d89c93 | 2012-06-27 19:31:41 +0000 | [diff] [blame] | 44 | fTwoFormatLimit = false; |
bsalomon@google.com | 706f668 | 2012-10-23 14:53:55 +0000 | [diff] [blame] | 45 | fFragCoordsConventionSupport = false; |
bsalomon@google.com | 07631cf | 2013-03-05 14:14:58 +0000 | [diff] [blame] | 46 | fVertexArrayObjectSupport = false; |
bsalomon@google.com | 96966a5 | 2013-02-21 16:34:21 +0000 | [diff] [blame] | 47 | fUseNonVBOVertexAndIndexDynamicData = false; |
bsalomon@google.com | 2b1b8c0 | 2013-02-28 22:06:02 +0000 | [diff] [blame] | 48 | fIsCoreProfile = false; |
robertphillips@google.com | 56ce48a | 2013-10-31 21:44:25 +0000 | [diff] [blame] | 49 | fFullClearIsFree = false; |
commit-bot@chromium.org | 4362a38 | 2014-03-26 19:49:03 +0000 | [diff] [blame] | 50 | fDropsTileOnZeroDivide = false; |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 51 | } |
| 52 | |
bsalomon@google.com | c26d94f | 2013-03-25 18:19:00 +0000 | [diff] [blame] | 53 | GrGLCaps::GrGLCaps(const GrGLCaps& caps) : GrDrawTargetCaps() { |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 54 | *this = caps; |
| 55 | } |
| 56 | |
commit-bot@chromium.org | beb8b3a | 2014-04-15 15:37:51 +0000 | [diff] [blame] | 57 | GrGLCaps& GrGLCaps::operator= (const GrGLCaps& caps) { |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 58 | INHERITED::operator=(caps); |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 59 | fVerifiedColorConfigs = caps.fVerifiedColorConfigs; |
| 60 | fStencilFormats = caps.fStencilFormats; |
| 61 | fStencilVerifiedColorConfigs = caps.fStencilVerifiedColorConfigs; |
krajcevski | 3217c4a | 2014-06-09 09:10:04 -0700 | [diff] [blame^] | 62 | fLATCAlias = caps.fLATCAlias; |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 63 | fMaxFragmentUniformVectors = caps.fMaxFragmentUniformVectors; |
bsalomon@google.com | 60da417 | 2012-06-01 19:25:00 +0000 | [diff] [blame] | 64 | fMaxVertexAttributes = caps.fMaxVertexAttributes; |
commit-bot@chromium.org | a15f7e5 | 2013-06-05 23:29:25 +0000 | [diff] [blame] | 65 | fMaxFragmentTextureUnits = caps.fMaxFragmentTextureUnits; |
commit-bot@chromium.org | 46fbfe0 | 2013-08-30 15:52:12 +0000 | [diff] [blame] | 66 | fMaxFixedFunctionTextureCoords = caps.fMaxFixedFunctionTextureCoords; |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 67 | fMSFBOType = caps.fMSFBOType; |
bsalomon@google.com | 6b0cf02 | 2013-05-03 13:35:14 +0000 | [diff] [blame] | 68 | fFBFetchType = caps.fFBFetchType; |
commit-bot@chromium.org | 52ffbf6 | 2014-04-02 16:19:33 +0000 | [diff] [blame] | 69 | fInvalidateFBType = caps.fInvalidateFBType; |
commit-bot@chromium.org | 160b478 | 2014-05-05 12:32:37 +0000 | [diff] [blame] | 70 | fMapBufferType = caps.fMapBufferType; |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 71 | fRGBA8RenderbufferSupport = caps.fRGBA8RenderbufferSupport; |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 72 | fBGRAIsInternalFormat = caps.fBGRAIsInternalFormat; |
| 73 | fTextureSwizzleSupport = caps.fTextureSwizzleSupport; |
| 74 | fUnpackRowLengthSupport = caps.fUnpackRowLengthSupport; |
| 75 | fUnpackFlipYSupport = caps.fUnpackFlipYSupport; |
| 76 | fPackRowLengthSupport = caps.fPackRowLengthSupport; |
| 77 | fPackFlipYSupport = caps.fPackFlipYSupport; |
| 78 | fTextureUsageSupport = caps.fTextureUsageSupport; |
| 79 | fTexStorageSupport = caps.fTexStorageSupport; |
robertphillips@google.com | 443e5a5 | 2012-04-30 20:01:21 +0000 | [diff] [blame] | 80 | fTextureRedSupport = caps.fTextureRedSupport; |
bsalomon@google.com | e76b7cc | 2012-06-18 12:47:06 +0000 | [diff] [blame] | 81 | fImagingSupport = caps.fImagingSupport; |
robertphillips@google.com | 1d89c93 | 2012-06-27 19:31:41 +0000 | [diff] [blame] | 82 | fTwoFormatLimit = caps.fTwoFormatLimit; |
bsalomon@google.com | 706f668 | 2012-10-23 14:53:55 +0000 | [diff] [blame] | 83 | fFragCoordsConventionSupport = caps.fFragCoordsConventionSupport; |
bsalomon@google.com | 07631cf | 2013-03-05 14:14:58 +0000 | [diff] [blame] | 84 | fVertexArrayObjectSupport = caps.fVertexArrayObjectSupport; |
bsalomon@google.com | 96966a5 | 2013-02-21 16:34:21 +0000 | [diff] [blame] | 85 | fUseNonVBOVertexAndIndexDynamicData = caps.fUseNonVBOVertexAndIndexDynamicData; |
bsalomon@google.com | 2b1b8c0 | 2013-02-28 22:06:02 +0000 | [diff] [blame] | 86 | fIsCoreProfile = caps.fIsCoreProfile; |
robertphillips@google.com | 56ce48a | 2013-10-31 21:44:25 +0000 | [diff] [blame] | 87 | fFullClearIsFree = caps.fFullClearIsFree; |
commit-bot@chromium.org | 4362a38 | 2014-03-26 19:49:03 +0000 | [diff] [blame] | 88 | fDropsTileOnZeroDivide = caps.fDropsTileOnZeroDivide; |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 89 | |
| 90 | return *this; |
| 91 | } |
| 92 | |
commit-bot@chromium.org | f4e67e3 | 2014-04-30 01:26:04 +0000 | [diff] [blame] | 93 | bool GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) { |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 94 | |
| 95 | this->reset(); |
| 96 | if (!ctxInfo.isInitialized()) { |
commit-bot@chromium.org | f4e67e3 | 2014-04-30 01:26:04 +0000 | [diff] [blame] | 97 | return false; |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 98 | } |
| 99 | |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 100 | GrGLStandard standard = ctxInfo.standard(); |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 101 | GrGLVersion version = ctxInfo.version(); |
| 102 | |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 103 | /************************************************************************** |
| 104 | * Caps specific to GrGLCaps |
| 105 | **************************************************************************/ |
| 106 | |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 107 | if (kGLES_GrGLStandard == standard) { |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 108 | GR_GL_GetIntegerv(gli, GR_GL_MAX_FRAGMENT_UNIFORM_VECTORS, |
| 109 | &fMaxFragmentUniformVectors); |
| 110 | } else { |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 111 | SkASSERT(kGL_GrGLStandard == standard); |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 112 | GrGLint max; |
| 113 | GR_GL_GetIntegerv(gli, GR_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &max); |
| 114 | fMaxFragmentUniformVectors = max / 4; |
commit-bot@chromium.org | 46fbfe0 | 2013-08-30 15:52:12 +0000 | [diff] [blame] | 115 | if (version >= GR_GL_VER(3, 2)) { |
| 116 | GrGLint profileMask; |
| 117 | GR_GL_GetIntegerv(gli, GR_GL_CONTEXT_PROFILE_MASK, &profileMask); |
| 118 | fIsCoreProfile = SkToBool(profileMask & GR_GL_CONTEXT_CORE_PROFILE_BIT); |
| 119 | } |
| 120 | if (!fIsCoreProfile) { |
| 121 | GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_COORDS, &fMaxFixedFunctionTextureCoords); |
| 122 | // Sanity check |
| 123 | SkASSERT(fMaxFixedFunctionTextureCoords > 0 && fMaxFixedFunctionTextureCoords < 128); |
| 124 | } |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 125 | } |
bsalomon@google.com | 60da417 | 2012-06-01 19:25:00 +0000 | [diff] [blame] | 126 | GR_GL_GetIntegerv(gli, GR_GL_MAX_VERTEX_ATTRIBS, &fMaxVertexAttributes); |
commit-bot@chromium.org | a15f7e5 | 2013-06-05 23:29:25 +0000 | [diff] [blame] | 127 | GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_IMAGE_UNITS, &fMaxFragmentTextureUnits); |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 128 | |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 129 | if (kGL_GrGLStandard == standard) { |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 130 | fRGBA8RenderbufferSupport = true; |
| 131 | } else { |
commit-bot@chromium.org | c5dffe4 | 2013-08-20 15:25:21 +0000 | [diff] [blame] | 132 | fRGBA8RenderbufferSupport = version >= GR_GL_VER(3,0) || |
| 133 | ctxInfo.hasExtension("GL_OES_rgb8_rgba8") || |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 134 | ctxInfo.hasExtension("GL_ARM_rgba8"); |
| 135 | } |
| 136 | |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 137 | if (kGL_GrGLStandard == standard) { |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 138 | fTextureSwizzleSupport = version >= GR_GL_VER(3,3) || |
| 139 | ctxInfo.hasExtension("GL_ARB_texture_swizzle"); |
| 140 | } else { |
commit-bot@chromium.org | 6364b5e | 2013-08-20 20:22:52 +0000 | [diff] [blame] | 141 | fTextureSwizzleSupport = version >= GR_GL_VER(3,0); |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 142 | } |
| 143 | |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 144 | if (kGL_GrGLStandard == standard) { |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 145 | fUnpackRowLengthSupport = true; |
| 146 | fUnpackFlipYSupport = false; |
| 147 | fPackRowLengthSupport = true; |
| 148 | fPackFlipYSupport = false; |
| 149 | } else { |
commit-bot@chromium.org | dc3134c | 2013-08-16 16:12:23 +0000 | [diff] [blame] | 150 | fUnpackRowLengthSupport = version >= GR_GL_VER(3,0) || |
| 151 | ctxInfo.hasExtension("GL_EXT_unpack_subimage"); |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 152 | fUnpackFlipYSupport = ctxInfo.hasExtension("GL_CHROMIUM_flipy"); |
commit-bot@chromium.org | dc3134c | 2013-08-16 16:12:23 +0000 | [diff] [blame] | 153 | fPackRowLengthSupport = version >= GR_GL_VER(3,0) || |
| 154 | ctxInfo.hasExtension("GL_NV_pack_subimage"); |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 155 | fPackFlipYSupport = |
| 156 | ctxInfo.hasExtension("GL_ANGLE_pack_reverse_row_order"); |
| 157 | } |
| 158 | |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 159 | fTextureUsageSupport = (kGLES_GrGLStandard == standard) && |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 160 | ctxInfo.hasExtension("GL_ANGLE_texture_usage"); |
| 161 | |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 162 | if (kGL_GrGLStandard == standard) { |
commit-bot@chromium.org | 7a434a2 | 2013-08-21 14:01:56 +0000 | [diff] [blame] | 163 | // The EXT version can apply to either GL or GLES. |
| 164 | fTexStorageSupport = version >= GR_GL_VER(4,2) || |
| 165 | ctxInfo.hasExtension("GL_ARB_texture_storage") || |
| 166 | ctxInfo.hasExtension("GL_EXT_texture_storage"); |
| 167 | } else { |
| 168 | // Qualcomm Adreno drivers appear to have issues with texture storage. |
| 169 | fTexStorageSupport = (version >= GR_GL_VER(3,0) && |
| 170 | kQualcomm_GrGLVendor != ctxInfo.vendor()) || |
| 171 | ctxInfo.hasExtension("GL_EXT_texture_storage"); |
| 172 | } |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 173 | |
commit-bot@chromium.org | 459104c | 2013-06-14 14:42:56 +0000 | [diff] [blame] | 174 | // ARB_texture_rg is part of OpenGL 3.0, but mesa doesn't support it if |
| 175 | // it doesn't have ARB_texture_rg extension. |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 176 | if (kGL_GrGLStandard == standard) { |
commit-bot@chromium.org | 459104c | 2013-06-14 14:42:56 +0000 | [diff] [blame] | 177 | if (ctxInfo.isMesa()) { |
| 178 | fTextureRedSupport = ctxInfo.hasExtension("GL_ARB_texture_rg"); |
| 179 | } else { |
| 180 | fTextureRedSupport = version >= GR_GL_VER(3,0) || |
| 181 | ctxInfo.hasExtension("GL_ARB_texture_rg"); |
| 182 | } |
robertphillips@google.com | 443e5a5 | 2012-04-30 20:01:21 +0000 | [diff] [blame] | 183 | } else { |
commit-bot@chromium.org | c5dffe4 | 2013-08-20 15:25:21 +0000 | [diff] [blame] | 184 | fTextureRedSupport = version >= GR_GL_VER(3,0) || |
| 185 | ctxInfo.hasExtension("GL_EXT_texture_rg"); |
robertphillips@google.com | 443e5a5 | 2012-04-30 20:01:21 +0000 | [diff] [blame] | 186 | } |
| 187 | |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 188 | fImagingSupport = kGL_GrGLStandard == standard && |
bsalomon@google.com | e76b7cc | 2012-06-18 12:47:06 +0000 | [diff] [blame] | 189 | ctxInfo.hasExtension("GL_ARB_imaging"); |
| 190 | |
robertphillips@google.com | 1d89c93 | 2012-06-27 19:31:41 +0000 | [diff] [blame] | 191 | // ES 2 only guarantees RGBA/uchar + one other format/type combo for |
| 192 | // ReadPixels. The other format has to checked at run-time since it |
| 193 | // can change based on which render target is bound |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 194 | fTwoFormatLimit = kGLES_GrGLStandard == standard; |
robertphillips@google.com | 1d89c93 | 2012-06-27 19:31:41 +0000 | [diff] [blame] | 195 | |
bsalomon@google.com | 706f668 | 2012-10-23 14:53:55 +0000 | [diff] [blame] | 196 | // Known issue on at least some Intel platforms: |
| 197 | // http://code.google.com/p/skia/issues/detail?id=946 |
| 198 | if (kIntel_GrGLVendor != ctxInfo.vendor()) { |
| 199 | fFragCoordsConventionSupport = ctxInfo.glslGeneration() >= k150_GrGLSLGeneration || |
| 200 | ctxInfo.hasExtension("GL_ARB_fragment_coord_conventions"); |
| 201 | } |
| 202 | |
bsalomon@google.com | 3012ded | 2013-02-22 16:44:04 +0000 | [diff] [blame] | 203 | // SGX and Mali GPUs that are based on a tiled-deferred architecture that have trouble with |
| 204 | // frequently changing VBOs. We've measured a performance increase using non-VBO vertex |
| 205 | // data for dynamic content on these GPUs. Perhaps we should read the renderer string and |
| 206 | // limit this decision to specific GPU families rather than basing it on the vendor alone. |
| 207 | if (!GR_GL_MUST_USE_VBO && |
| 208 | (kARM_GrGLVendor == ctxInfo.vendor() || kImagination_GrGLVendor == ctxInfo.vendor())) { |
bsalomon@google.com | 96966a5 | 2013-02-21 16:34:21 +0000 | [diff] [blame] | 209 | fUseNonVBOVertexAndIndexDynamicData = true; |
| 210 | } |
skia.committer@gmail.com | 631cdcb | 2013-03-01 12:12:55 +0000 | [diff] [blame] | 211 | |
commit-bot@chromium.org | 52ffbf6 | 2014-04-02 16:19:33 +0000 | [diff] [blame] | 212 | if ((kGL_GrGLStandard == standard && version >= GR_GL_VER(4,3)) || |
skia.committer@gmail.com | a915772 | 2014-04-03 03:04:26 +0000 | [diff] [blame] | 213 | (kGLES_GrGLStandard == standard && version >= GR_GL_VER(3,0)) || |
commit-bot@chromium.org | 52ffbf6 | 2014-04-02 16:19:33 +0000 | [diff] [blame] | 214 | ctxInfo.hasExtension("GL_ARB_invalidate_subdata")) { |
| 215 | fDiscardRenderTargetSupport = true; |
| 216 | fInvalidateFBType = kInvalidate_InvalidateFBType; |
| 217 | } else if (ctxInfo.hasExtension("GL_EXT_discard_framebuffer")) { |
| 218 | fDiscardRenderTargetSupport = true; |
| 219 | fInvalidateFBType = kDiscard_InvalidateFBType; |
| 220 | } |
robertphillips@google.com | a6ffb58 | 2013-04-29 16:50:17 +0000 | [diff] [blame] | 221 | |
robertphillips@google.com | 56ce48a | 2013-10-31 21:44:25 +0000 | [diff] [blame] | 222 | if (kARM_GrGLVendor == ctxInfo.vendor() || kImagination_GrGLVendor == ctxInfo.vendor()) { |
| 223 | fFullClearIsFree = true; |
| 224 | } |
| 225 | |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 226 | if (kGL_GrGLStandard == standard) { |
bsalomon@google.com | 07631cf | 2013-03-05 14:14:58 +0000 | [diff] [blame] | 227 | fVertexArrayObjectSupport = version >= GR_GL_VER(3, 0) || |
| 228 | ctxInfo.hasExtension("GL_ARB_vertex_array_object"); |
| 229 | } else { |
commit-bot@chromium.org | 2276c01 | 2013-08-16 15:53:33 +0000 | [diff] [blame] | 230 | fVertexArrayObjectSupport = version >= GR_GL_VER(3, 0) || |
| 231 | ctxInfo.hasExtension("GL_OES_vertex_array_object"); |
bsalomon@google.com | 07631cf | 2013-03-05 14:14:58 +0000 | [diff] [blame] | 232 | } |
| 233 | |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 234 | if (kGLES_GrGLStandard == standard) { |
bsalomon@google.com | 6b0cf02 | 2013-05-03 13:35:14 +0000 | [diff] [blame] | 235 | if (ctxInfo.hasExtension("GL_EXT_shader_framebuffer_fetch")) { |
| 236 | fFBFetchType = kEXT_FBFetchType; |
| 237 | } else if (ctxInfo.hasExtension("GL_NV_shader_framebuffer_fetch")) { |
| 238 | fFBFetchType = kNV_FBFetchType; |
| 239 | } |
| 240 | } |
| 241 | |
commit-bot@chromium.org | 4362a38 | 2014-03-26 19:49:03 +0000 | [diff] [blame] | 242 | // Adreno GPUs have a tendency to drop tiles when there is a divide-by-zero in a shader |
| 243 | fDropsTileOnZeroDivide = kQualcomm_GrGLVendor == ctxInfo.vendor(); |
| 244 | |
robertphillips@google.com | 6177e69 | 2013-02-28 20:16:25 +0000 | [diff] [blame] | 245 | this->initFSAASupport(ctxInfo, gli); |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 246 | this->initStencilFormats(ctxInfo); |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 247 | |
| 248 | /************************************************************************** |
bsalomon@google.com | c26d94f | 2013-03-25 18:19:00 +0000 | [diff] [blame] | 249 | * GrDrawTargetCaps fields |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 250 | **************************************************************************/ |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 251 | if (kGL_GrGLStandard == standard) { |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 252 | // we could also look for GL_ATI_separate_stencil extension or |
| 253 | // GL_EXT_stencil_two_side but they use different function signatures |
| 254 | // than GL2.0+ (and than each other). |
| 255 | fTwoSidedStencilSupport = (ctxInfo.version() >= GR_GL_VER(2,0)); |
| 256 | // supported on GL 1.4 and higher or by extension |
| 257 | fStencilWrapOpsSupport = (ctxInfo.version() >= GR_GL_VER(1,4)) || |
| 258 | ctxInfo.hasExtension("GL_EXT_stencil_wrap"); |
| 259 | } else { |
| 260 | // ES 2 has two sided stencil and stencil wrap |
| 261 | fTwoSidedStencilSupport = true; |
| 262 | fStencilWrapOpsSupport = true; |
| 263 | } |
| 264 | |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 265 | if (kGL_GrGLStandard == standard) { |
commit-bot@chromium.org | 160b478 | 2014-05-05 12:32:37 +0000 | [diff] [blame] | 266 | fMapBufferFlags = kCanMap_MapFlag; // we require VBO support and the desktop VBO |
| 267 | // extension includes glMapBuffer. |
| 268 | if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_ARB_map_buffer_range")) { |
| 269 | fMapBufferFlags |= kSubset_MapFlag; |
| 270 | fMapBufferType = kMapBufferRange_MapBufferType; |
| 271 | } else { |
| 272 | fMapBufferType = kMapBuffer_MapBufferType; |
| 273 | } |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 274 | } else { |
commit-bot@chromium.org | 160b478 | 2014-05-05 12:32:37 +0000 | [diff] [blame] | 275 | // Unextended GLES2 doesn't have any buffer mapping. |
| 276 | fMapBufferFlags = kNone_MapBufferType; |
| 277 | if (ctxInfo.hasExtension("GL_CHROMIUM_map_sub")) { |
| 278 | fMapBufferFlags = kCanMap_MapFlag | kSubset_MapFlag; |
| 279 | fMapBufferType = kChromium_MapBufferType; |
| 280 | } else if (version >= GR_GL_VER(3, 0) || ctxInfo.hasExtension("GL_EXT_map_buffer_range")) { |
| 281 | fMapBufferFlags = kCanMap_MapFlag | kSubset_MapFlag; |
| 282 | fMapBufferType = kMapBufferRange_MapBufferType; |
| 283 | } else if (ctxInfo.hasExtension("GL_OES_mapbuffer")) { |
| 284 | fMapBufferFlags = kCanMap_MapFlag; |
| 285 | fMapBufferType = kMapBuffer_MapBufferType; |
| 286 | } |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 287 | } |
| 288 | |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 289 | if (kGL_GrGLStandard == standard) { |
commit-bot@chromium.org | 4744231 | 2013-12-19 16:18:01 +0000 | [diff] [blame] | 290 | SkASSERT(ctxInfo.version() >= GR_GL_VER(2,0) || |
| 291 | ctxInfo.hasExtension("GL_ARB_texture_non_power_of_two")); |
| 292 | fNPOTTextureTileSupport = true; |
| 293 | fMipMapSupport = true; |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 294 | } else { |
| 295 | // Unextended ES2 supports NPOT textures with clamp_to_edge and non-mip filters only |
commit-bot@chromium.org | 22dd6b9 | 2013-08-16 18:13:48 +0000 | [diff] [blame] | 296 | // ES3 has no limitations. |
| 297 | fNPOTTextureTileSupport = ctxInfo.version() >= GR_GL_VER(3,0) || |
| 298 | ctxInfo.hasExtension("GL_OES_texture_npot"); |
commit-bot@chromium.org | 4744231 | 2013-12-19 16:18:01 +0000 | [diff] [blame] | 299 | // ES2 supports MIP mapping for POT textures but our caps don't allow for limited MIP |
| 300 | // support. The OES extension or ES 3.0 allow for MIPS on NPOT textures. So, apparently, |
| 301 | // does the undocumented GL_IMG_texture_npot extension. This extension does not seem to |
| 302 | // to alllow arbitrary wrap modes, however. |
| 303 | fMipMapSupport = fNPOTTextureTileSupport || ctxInfo.hasExtension("GL_IMG_texture_npot"); |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 304 | } |
| 305 | |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 306 | fHWAALineSupport = (kGL_GrGLStandard == standard); |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 307 | |
| 308 | GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_SIZE, &fMaxTextureSize); |
| 309 | GR_GL_GetIntegerv(gli, GR_GL_MAX_RENDERBUFFER_SIZE, &fMaxRenderTargetSize); |
| 310 | // Our render targets are always created with textures as the color |
| 311 | // attachment, hence this min: |
commit-bot@chromium.org | 972f9cd | 2014-03-28 17:58:28 +0000 | [diff] [blame] | 312 | fMaxRenderTargetSize = SkTMin(fMaxTextureSize, fMaxRenderTargetSize); |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 313 | |
commit-bot@chromium.org | f669672 | 2014-04-25 06:21:30 +0000 | [diff] [blame] | 314 | fPathRenderingSupport = ctxInfo.hasExtension("GL_NV_path_rendering") && |
| 315 | ctxInfo.hasExtension("GL_EXT_direct_state_access"); |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 316 | |
commit-bot@chromium.org | a3baf3b | 2014-02-21 18:45:30 +0000 | [diff] [blame] | 317 | fGpuTracingSupport = ctxInfo.hasExtension("GL_EXT_debug_marker"); |
| 318 | |
bsalomon@google.com | 6b0cf02 | 2013-05-03 13:35:14 +0000 | [diff] [blame] | 319 | fDstReadInShaderSupport = kNone_FBFetchType != fFBFetchType; |
robertphillips@google.com | 8995b7b | 2013-11-01 15:03:34 +0000 | [diff] [blame] | 320 | |
| 321 | // Disable scratch texture reuse on Mali and Adreno devices |
| 322 | fReuseScratchTextures = kARM_GrGLVendor != ctxInfo.vendor() && |
| 323 | kQualcomm_GrGLVendor != ctxInfo.vendor(); |
commit-bot@chromium.org | b835652 | 2013-07-18 22:26:39 +0000 | [diff] [blame] | 324 | |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 325 | // Enable supported shader-related caps |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 326 | if (kGL_GrGLStandard == standard) { |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 327 | fDualSourceBlendingSupport = ctxInfo.version() >= GR_GL_VER(3,3) || |
| 328 | ctxInfo.hasExtension("GL_ARB_blend_func_extended"); |
| 329 | fShaderDerivativeSupport = true; |
| 330 | // we don't support GL_ARB_geometry_shader4, just GL 3.2+ GS |
| 331 | fGeometryShaderSupport = ctxInfo.version() >= GR_GL_VER(3,2) && |
| 332 | ctxInfo.glslGeneration() >= k150_GrGLSLGeneration; |
| 333 | } else { |
| 334 | fShaderDerivativeSupport = ctxInfo.hasExtension("GL_OES_standard_derivatives"); |
| 335 | } |
| 336 | |
bsalomon@google.com | 347c382 | 2013-05-01 20:10:01 +0000 | [diff] [blame] | 337 | if (GrGLCaps::kES_IMG_MsToTexture_MSFBOType == fMSFBOType) { |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 338 | GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES_IMG, &fMaxSampleCount); |
| 339 | } else if (GrGLCaps::kNone_MSFBOType != fMSFBOType) { |
| 340 | GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES, &fMaxSampleCount); |
| 341 | } |
commit-bot@chromium.org | 7388051 | 2013-10-14 15:33:45 +0000 | [diff] [blame] | 342 | |
commit-bot@chromium.org | 6e7ddaa | 2014-05-30 13:55:58 +0000 | [diff] [blame] | 343 | this->initConfigTexturableTable(ctxInfo, gli); |
commit-bot@chromium.org | 7388051 | 2013-10-14 15:33:45 +0000 | [diff] [blame] | 344 | this->initConfigRenderableTable(ctxInfo); |
commit-bot@chromium.org | f4e67e3 | 2014-04-30 01:26:04 +0000 | [diff] [blame] | 345 | |
| 346 | return true; |
commit-bot@chromium.org | 7388051 | 2013-10-14 15:33:45 +0000 | [diff] [blame] | 347 | } |
| 348 | |
| 349 | void GrGLCaps::initConfigRenderableTable(const GrGLContextInfo& ctxInfo) { |
| 350 | |
| 351 | // OpenGL < 3.0 |
| 352 | // no support for render targets unless the GL_ARB_framebuffer_object |
| 353 | // extension is supported (in which case we get ALPHA, RED, RG, RGB, |
| 354 | // RGBA (ALPHA8, RGBA4, RGBA8) for OpenGL > 1.1). Note that we |
| 355 | // probably don't get R8 in this case. |
| 356 | |
| 357 | // OpenGL 3.0 |
| 358 | // base color renderable: ALPHA, RED, RG, RGB, and RGBA |
| 359 | // sized derivatives: ALPHA8, R8, RGBA4, RGBA8 |
| 360 | |
| 361 | // >= OpenGL 3.1 |
| 362 | // base color renderable: RED, RG, RGB, and RGBA |
| 363 | // sized derivatives: R8, RGBA4, RGBA8 |
| 364 | // if the GL_ARB_compatibility extension is supported then we get back |
| 365 | // support for GL_ALPHA and ALPHA8 |
| 366 | |
| 367 | // GL_EXT_bgra adds BGRA render targets to any version |
| 368 | |
| 369 | // ES 2.0 |
| 370 | // color renderable: RGBA4, RGB5_A1, RGB565 |
| 371 | // GL_EXT_texture_rg adds support for R8 as a color render target |
| 372 | // GL_OES_rgb8_rgba8 and/or GL_ARM_rgba8 adds support for RGBA8 |
| 373 | // GL_EXT_texture_format_BGRA8888 and/or GL_APPLE_texture_format_BGRA8888 added BGRA support |
| 374 | |
| 375 | // ES 3.0 |
| 376 | // Same as ES 2.0 except R8 and RGBA8 are supported without extensions (the functions called |
| 377 | // below already account for this). |
| 378 | |
commit-bot@chromium.org | 6e7ddaa | 2014-05-30 13:55:58 +0000 | [diff] [blame] | 379 | GrGLStandard standard = ctxInfo.standard(); |
| 380 | |
commit-bot@chromium.org | 6b7938f | 2013-10-15 14:18:16 +0000 | [diff] [blame] | 381 | enum { |
| 382 | kNo_MSAA = 0, |
| 383 | kYes_MSAA = 1, |
| 384 | }; |
| 385 | |
commit-bot@chromium.org | 6e7ddaa | 2014-05-30 13:55:58 +0000 | [diff] [blame] | 386 | if (kGL_GrGLStandard == standard) { |
commit-bot@chromium.org | 7388051 | 2013-10-14 15:33:45 +0000 | [diff] [blame] | 387 | // Post 3.0 we will get R8 |
| 388 | // Prior to 3.0 we will get ALPHA8 (with GL_ARB_framebuffer_object) |
| 389 | if (ctxInfo.version() >= GR_GL_VER(3,0) || |
| 390 | ctxInfo.hasExtension("GL_ARB_framebuffer_object")) { |
commit-bot@chromium.org | 6b7938f | 2013-10-15 14:18:16 +0000 | [diff] [blame] | 391 | fConfigRenderSupport[kAlpha_8_GrPixelConfig][kNo_MSAA] = true; |
| 392 | fConfigRenderSupport[kAlpha_8_GrPixelConfig][kYes_MSAA] = true; |
commit-bot@chromium.org | 7388051 | 2013-10-14 15:33:45 +0000 | [diff] [blame] | 393 | } |
| 394 | } else { |
| 395 | // On ES we can only hope for R8 |
commit-bot@chromium.org | 6b7938f | 2013-10-15 14:18:16 +0000 | [diff] [blame] | 396 | fConfigRenderSupport[kAlpha_8_GrPixelConfig][kNo_MSAA] = fTextureRedSupport; |
| 397 | fConfigRenderSupport[kAlpha_8_GrPixelConfig][kYes_MSAA] = fTextureRedSupport; |
commit-bot@chromium.org | 7388051 | 2013-10-14 15:33:45 +0000 | [diff] [blame] | 398 | } |
| 399 | |
commit-bot@chromium.org | 6e7ddaa | 2014-05-30 13:55:58 +0000 | [diff] [blame] | 400 | if (kGL_GrGLStandard != standard) { |
commit-bot@chromium.org | 7388051 | 2013-10-14 15:33:45 +0000 | [diff] [blame] | 401 | // only available in ES |
commit-bot@chromium.org | 6b7938f | 2013-10-15 14:18:16 +0000 | [diff] [blame] | 402 | fConfigRenderSupport[kRGB_565_GrPixelConfig][kNo_MSAA] = true; |
| 403 | fConfigRenderSupport[kRGB_565_GrPixelConfig][kYes_MSAA] = true; |
commit-bot@chromium.org | 7388051 | 2013-10-14 15:33:45 +0000 | [diff] [blame] | 404 | } |
| 405 | |
| 406 | // we no longer support 444 as a render target |
commit-bot@chromium.org | 6b7938f | 2013-10-15 14:18:16 +0000 | [diff] [blame] | 407 | fConfigRenderSupport[kRGBA_4444_GrPixelConfig][kNo_MSAA] = false; |
| 408 | fConfigRenderSupport[kRGBA_4444_GrPixelConfig][kYes_MSAA] = false; |
commit-bot@chromium.org | 7388051 | 2013-10-14 15:33:45 +0000 | [diff] [blame] | 409 | |
| 410 | if (this->fRGBA8RenderbufferSupport) { |
commit-bot@chromium.org | 6b7938f | 2013-10-15 14:18:16 +0000 | [diff] [blame] | 411 | fConfigRenderSupport[kRGBA_8888_GrPixelConfig][kNo_MSAA] = true; |
commit-bot@chromium.org | da3d69c | 2013-10-28 15:09:13 +0000 | [diff] [blame] | 412 | fConfigRenderSupport[kRGBA_8888_GrPixelConfig][kYes_MSAA] = true; |
commit-bot@chromium.org | 7388051 | 2013-10-14 15:33:45 +0000 | [diff] [blame] | 413 | } |
| 414 | |
commit-bot@chromium.org | 6e7ddaa | 2014-05-30 13:55:58 +0000 | [diff] [blame] | 415 | if (this->isConfigTexturable(kBGRA_8888_GrPixelConfig)) { |
commit-bot@chromium.org | 6b7938f | 2013-10-15 14:18:16 +0000 | [diff] [blame] | 416 | fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kNo_MSAA] = true; |
| 417 | // The GL_EXT_texture_format_BGRA8888 extension does not add BGRA to the list of |
| 418 | // configs that are color-renderable and can be passed to glRenderBufferStorageMultisample. |
commit-bot@chromium.org | 4256d24 | 2013-10-17 16:29:41 +0000 | [diff] [blame] | 419 | // Chromium may have an extension to allow BGRA renderbuffers to work on desktop platforms. |
commit-bot@chromium.org | 90313cc | 2014-01-17 15:05:38 +0000 | [diff] [blame] | 420 | if (ctxInfo.hasExtension("GL_CHROMIUM_renderbuffer_format_BGRA8888")) { |
commit-bot@chromium.org | 4256d24 | 2013-10-17 16:29:41 +0000 | [diff] [blame] | 421 | fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kYes_MSAA] = true; |
| 422 | } else { |
| 423 | fConfigRenderSupport[kBGRA_8888_GrPixelConfig][kYes_MSAA] = |
| 424 | !fBGRAIsInternalFormat || !this->usesMSAARenderBuffers(); |
| 425 | } |
commit-bot@chromium.org | 6b7938f | 2013-10-15 14:18:16 +0000 | [diff] [blame] | 426 | } |
| 427 | |
| 428 | // If we don't support MSAA then undo any places above where we set a config as renderable with |
| 429 | // msaa. |
| 430 | if (kNone_MSFBOType == fMSFBOType) { |
| 431 | for (int i = 0; i < kGrPixelConfigCnt; ++i) { |
| 432 | fConfigRenderSupport[i][kYes_MSAA] = false; |
| 433 | } |
commit-bot@chromium.org | 7388051 | 2013-10-14 15:33:45 +0000 | [diff] [blame] | 434 | } |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 435 | } |
| 436 | |
commit-bot@chromium.org | 6e7ddaa | 2014-05-30 13:55:58 +0000 | [diff] [blame] | 437 | void GrGLCaps::initConfigTexturableTable(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) { |
commit-bot@chromium.org | 42dc813 | 2014-05-27 19:26:59 +0000 | [diff] [blame] | 438 | GrGLStandard standard = ctxInfo.standard(); |
| 439 | GrGLVersion version = ctxInfo.version(); |
| 440 | |
commit-bot@chromium.org | 6e7ddaa | 2014-05-30 13:55:58 +0000 | [diff] [blame] | 441 | // Base texture support |
| 442 | fConfigTextureSupport[kAlpha_8_GrPixelConfig] = true; |
| 443 | fConfigTextureSupport[kRGB_565_GrPixelConfig] = true; |
| 444 | fConfigTextureSupport[kRGBA_4444_GrPixelConfig] = true; |
| 445 | fConfigTextureSupport[kRGBA_8888_GrPixelConfig] = true; |
| 446 | |
| 447 | // Check for 8-bit palette.. |
| 448 | GrGLint numFormats; |
| 449 | GR_GL_GetIntegerv(gli, GR_GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numFormats); |
| 450 | if (numFormats) { |
| 451 | SkAutoSTMalloc<10, GrGLint> formats(numFormats); |
| 452 | GR_GL_GetIntegerv(gli, GR_GL_COMPRESSED_TEXTURE_FORMATS, formats); |
| 453 | for (int i = 0; i < numFormats; ++i) { |
| 454 | if (GR_GL_PALETTE8_RGBA8 == formats[i]) { |
| 455 | fConfigTextureSupport[kIndex_8_GrPixelConfig] = true; |
| 456 | break; |
| 457 | } |
| 458 | } |
| 459 | } |
| 460 | |
| 461 | // Check for BGRA |
| 462 | if (kGL_GrGLStandard == standard) { |
| 463 | fConfigTextureSupport[kBGRA_8888_GrPixelConfig] = |
| 464 | version >= GR_GL_VER(1,2) || ctxInfo.hasExtension("GL_EXT_bgra"); |
| 465 | } else { |
| 466 | if (ctxInfo.hasExtension("GL_APPLE_texture_format_BGRA8888")) { |
| 467 | fConfigTextureSupport[kBGRA_8888_GrPixelConfig] = true; |
| 468 | } else if (ctxInfo.hasExtension("GL_EXT_texture_format_BGRA8888")) { |
| 469 | fConfigTextureSupport[kBGRA_8888_GrPixelConfig] = true; |
| 470 | fBGRAIsInternalFormat = true; |
| 471 | } |
| 472 | SkASSERT(fConfigTextureSupport[kBGRA_8888_GrPixelConfig] || |
| 473 | kSkia8888_GrPixelConfig != kBGRA_8888_GrPixelConfig); |
| 474 | } |
| 475 | |
| 476 | // Compressed texture support |
| 477 | |
commit-bot@chromium.org | 42dc813 | 2014-05-27 19:26:59 +0000 | [diff] [blame] | 478 | // glCompressedTexImage2D is available on all OpenGL ES devices... |
| 479 | // however, it is only available on standard OpenGL after version 1.3 |
commit-bot@chromium.org | 6e7ddaa | 2014-05-30 13:55:58 +0000 | [diff] [blame] | 480 | bool hasCompressTex2D = (kGL_GrGLStandard != standard || version >= GR_GL_VER(1, 3)); |
commit-bot@chromium.org | 42dc813 | 2014-05-27 19:26:59 +0000 | [diff] [blame] | 481 | |
| 482 | // Check for ETC1 |
| 483 | bool hasETC1 = false; |
| 484 | |
| 485 | // First check version for support |
| 486 | if (kGL_GrGLStandard == standard) { |
commit-bot@chromium.org | 6e7ddaa | 2014-05-30 13:55:58 +0000 | [diff] [blame] | 487 | hasETC1 = hasCompressTex2D && |
| 488 | (version >= GR_GL_VER(4, 3) || |
| 489 | ctxInfo.hasExtension("GL_ARB_ES3_compatibility")); |
commit-bot@chromium.org | 42dc813 | 2014-05-27 19:26:59 +0000 | [diff] [blame] | 490 | } else { |
commit-bot@chromium.org | 6e7ddaa | 2014-05-30 13:55:58 +0000 | [diff] [blame] | 491 | hasETC1 = hasCompressTex2D && |
| 492 | (version >= GR_GL_VER(3, 0) || |
| 493 | ctxInfo.hasExtension("GL_OES_compressed_ETC1_RGB8_texture") || |
| 494 | // ETC2 is a superset of ETC1, so we can just check for that, too. |
| 495 | (ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGB8_texture") && |
| 496 | ctxInfo.hasExtension("GL_OES_compressed_ETC2_RGBA8_texture"))); |
commit-bot@chromium.org | 42dc813 | 2014-05-27 19:26:59 +0000 | [diff] [blame] | 497 | } |
commit-bot@chromium.org | 6e7ddaa | 2014-05-30 13:55:58 +0000 | [diff] [blame] | 498 | fConfigTextureSupport[kETC1_GrPixelConfig] = hasETC1; |
commit-bot@chromium.org | 42dc813 | 2014-05-27 19:26:59 +0000 | [diff] [blame] | 499 | |
commit-bot@chromium.org | 6e7ddaa | 2014-05-30 13:55:58 +0000 | [diff] [blame] | 500 | // Check for LATC under its various forms |
| 501 | LATCAlias alias = kLATC_LATCAlias; |
| 502 | bool hasLATC = hasCompressTex2D && |
| 503 | (ctxInfo.hasExtension("GL_EXT_texture_compression_latc") || |
| 504 | ctxInfo.hasExtension("GL_NV_texture_compression_latc")); |
| 505 | |
| 506 | // Check for RGTC |
| 507 | if (!hasLATC) { |
| 508 | // If we're using OpenGL 3.0 or later, then we have RGTC, an identical compression format. |
| 509 | if (kGL_GrGLStandard == standard) { |
| 510 | hasLATC = version >= GR_GL_VER(3, 0); |
| 511 | } |
| 512 | |
| 513 | if (!hasLATC) { |
| 514 | hasLATC = |
| 515 | ctxInfo.hasExtension("GL_EXT_texture_compression_rgtc") || |
| 516 | ctxInfo.hasExtension("GL_ARB_texture_compression_rgtc"); |
| 517 | } |
| 518 | |
| 519 | if (hasLATC) { |
| 520 | alias = kRGTC_LATCAlias; |
| 521 | } |
| 522 | } |
| 523 | |
| 524 | // Check for 3DC |
| 525 | if (!hasLATC) { |
| 526 | hasLATC = ctxInfo.hasExtension("GL_AMD_compressed_3DC_texture"); |
| 527 | if (hasLATC) { |
| 528 | alias = k3DC_LATCAlias; |
| 529 | } |
| 530 | } |
| 531 | |
| 532 | fConfigTextureSupport[kLATC_GrPixelConfig] = hasLATC; |
| 533 | fLATCAlias = alias; |
commit-bot@chromium.org | 42dc813 | 2014-05-27 19:26:59 +0000 | [diff] [blame] | 534 | } |
| 535 | |
robertphillips@google.com | 1d89c93 | 2012-06-27 19:31:41 +0000 | [diff] [blame] | 536 | bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf, |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 537 | GrGLenum format, |
| 538 | GrGLenum type) const { |
robertphillips@google.com | 1d89c93 | 2012-06-27 19:31:41 +0000 | [diff] [blame] | 539 | if (GR_GL_RGBA == format && GR_GL_UNSIGNED_BYTE == type) { |
| 540 | // ES 2 guarantees this format is supported |
robertphillips@google.com | eca2dfb | 2012-06-27 20:13:49 +0000 | [diff] [blame] | 541 | return true; |
robertphillips@google.com | 1d89c93 | 2012-06-27 19:31:41 +0000 | [diff] [blame] | 542 | } |
| 543 | |
| 544 | if (!fTwoFormatLimit) { |
| 545 | // not limited by ES 2's constraints |
| 546 | return true; |
| 547 | } |
| 548 | |
bsalomon@google.com | 548a433 | 2012-07-11 19:45:22 +0000 | [diff] [blame] | 549 | GrGLint otherFormat = GR_GL_RGBA; |
| 550 | GrGLint otherType = GR_GL_UNSIGNED_BYTE; |
robertphillips@google.com | 1d89c93 | 2012-06-27 19:31:41 +0000 | [diff] [blame] | 551 | |
| 552 | // The other supported format/type combo supported for ReadPixels |
| 553 | // can change based on which render target is bound |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 554 | GR_GL_GetIntegerv(intf, |
robertphillips@google.com | 1d89c93 | 2012-06-27 19:31:41 +0000 | [diff] [blame] | 555 | GR_GL_IMPLEMENTATION_COLOR_READ_FORMAT, |
| 556 | &otherFormat); |
| 557 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 558 | GR_GL_GetIntegerv(intf, |
robertphillips@google.com | 1d89c93 | 2012-06-27 19:31:41 +0000 | [diff] [blame] | 559 | GR_GL_IMPLEMENTATION_COLOR_READ_TYPE, |
| 560 | &otherType); |
| 561 | |
bsalomon@google.com | 548a433 | 2012-07-11 19:45:22 +0000 | [diff] [blame] | 562 | return (GrGLenum)otherFormat == format && (GrGLenum)otherType == type; |
robertphillips@google.com | 1d89c93 | 2012-06-27 19:31:41 +0000 | [diff] [blame] | 563 | } |
| 564 | |
robertphillips@google.com | 6177e69 | 2013-02-28 20:16:25 +0000 | [diff] [blame] | 565 | void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) { |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 566 | |
| 567 | fMSFBOType = kNone_MSFBOType; |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 568 | if (kGL_GrGLStandard != ctxInfo.standard()) { |
commit-bot@chromium.org | a8e5a06 | 2013-09-05 23:44:09 +0000 | [diff] [blame] | 569 | // We prefer the EXT/IMG extension over ES3 MSAA because we've observed |
| 570 | // ES3 driver bugs on at least one device with a tiled GPU (N10). |
| 571 | if (ctxInfo.hasExtension("GL_EXT_multisampled_render_to_texture")) { |
| 572 | fMSFBOType = kES_EXT_MsToTexture_MSFBOType; |
| 573 | } else if (ctxInfo.hasExtension("GL_IMG_multisampled_render_to_texture")) { |
| 574 | fMSFBOType = kES_IMG_MsToTexture_MSFBOType; |
commit-bot@chromium.org | 92b7884 | 2014-01-16 20:49:46 +0000 | [diff] [blame] | 575 | } else if (ctxInfo.version() >= GR_GL_VER(3,0)) { |
commit-bot@chromium.org | a8e5a06 | 2013-09-05 23:44:09 +0000 | [diff] [blame] | 576 | fMSFBOType = GrGLCaps::kES_3_0_MSFBOType; |
| 577 | } else if (ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_multisample")) { |
| 578 | // chrome's extension is equivalent to the EXT msaa |
| 579 | // and fbo_blit extensions. |
| 580 | fMSFBOType = kDesktop_EXT_MSFBOType; |
| 581 | } else if (ctxInfo.hasExtension("GL_APPLE_framebuffer_multisample")) { |
| 582 | fMSFBOType = kES_Apple_MSFBOType; |
| 583 | } |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 584 | } else { |
| 585 | if ((ctxInfo.version() >= GR_GL_VER(3,0)) || |
| 586 | ctxInfo.hasExtension("GL_ARB_framebuffer_object")) { |
bsalomon@google.com | 347c382 | 2013-05-01 20:10:01 +0000 | [diff] [blame] | 587 | fMSFBOType = GrGLCaps::kDesktop_ARB_MSFBOType; |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 588 | } else if (ctxInfo.hasExtension("GL_EXT_framebuffer_multisample") && |
| 589 | ctxInfo.hasExtension("GL_EXT_framebuffer_blit")) { |
bsalomon@google.com | 347c382 | 2013-05-01 20:10:01 +0000 | [diff] [blame] | 590 | fMSFBOType = GrGLCaps::kDesktop_EXT_MSFBOType; |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 591 | } |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 592 | } |
| 593 | } |
| 594 | |
| 595 | namespace { |
| 596 | const GrGLuint kUnknownBitCount = GrGLStencilBuffer::kUnknownBitCount; |
| 597 | } |
| 598 | |
| 599 | void GrGLCaps::initStencilFormats(const GrGLContextInfo& ctxInfo) { |
| 600 | |
| 601 | // Build up list of legal stencil formats (though perhaps not supported on |
| 602 | // the particular gpu/driver) from most preferred to least. |
| 603 | |
| 604 | // these consts are in order of most preferred to least preferred |
| 605 | // we don't bother with GL_STENCIL_INDEX1 or GL_DEPTH32F_STENCIL8 |
| 606 | |
| 607 | static const StencilFormat |
| 608 | // internal Format stencil bits total bits packed? |
| 609 | gS8 = {GR_GL_STENCIL_INDEX8, 8, 8, false}, |
| 610 | gS16 = {GR_GL_STENCIL_INDEX16, 16, 16, false}, |
| 611 | gD24S8 = {GR_GL_DEPTH24_STENCIL8, 8, 32, true }, |
| 612 | gS4 = {GR_GL_STENCIL_INDEX4, 4, 4, false}, |
caryclark@google.com | cf6285b | 2012-06-06 12:09:01 +0000 | [diff] [blame] | 613 | // gS = {GR_GL_STENCIL_INDEX, kUnknownBitCount, kUnknownBitCount, false}, |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 614 | gDS = {GR_GL_DEPTH_STENCIL, kUnknownBitCount, kUnknownBitCount, true }; |
| 615 | |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 616 | if (kGL_GrGLStandard == ctxInfo.standard()) { |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 617 | bool supportsPackedDS = |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 618 | ctxInfo.version() >= GR_GL_VER(3,0) || |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 619 | ctxInfo.hasExtension("GL_EXT_packed_depth_stencil") || |
| 620 | ctxInfo.hasExtension("GL_ARB_framebuffer_object"); |
| 621 | |
| 622 | // S1 thru S16 formats are in GL 3.0+, EXT_FBO, and ARB_FBO since we |
| 623 | // require FBO support we can expect these are legal formats and don't |
| 624 | // check. These also all support the unsized GL_STENCIL_INDEX. |
| 625 | fStencilFormats.push_back() = gS8; |
| 626 | fStencilFormats.push_back() = gS16; |
| 627 | if (supportsPackedDS) { |
| 628 | fStencilFormats.push_back() = gD24S8; |
| 629 | } |
| 630 | fStencilFormats.push_back() = gS4; |
| 631 | if (supportsPackedDS) { |
| 632 | fStencilFormats.push_back() = gDS; |
| 633 | } |
| 634 | } else { |
| 635 | // ES2 has STENCIL_INDEX8 without extensions but requires extensions |
| 636 | // for other formats. |
| 637 | // ES doesn't support using the unsized format. |
| 638 | |
| 639 | fStencilFormats.push_back() = gS8; |
| 640 | //fStencilFormats.push_back() = gS16; |
commit-bot@chromium.org | 04c500f | 2013-09-06 15:28:01 +0000 | [diff] [blame] | 641 | if (ctxInfo.version() >= GR_GL_VER(3,0) || |
| 642 | ctxInfo.hasExtension("GL_OES_packed_depth_stencil")) { |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 643 | fStencilFormats.push_back() = gD24S8; |
| 644 | } |
| 645 | if (ctxInfo.hasExtension("GL_OES_stencil4")) { |
| 646 | fStencilFormats.push_back() = gS4; |
| 647 | } |
| 648 | } |
tfarina@chromium.org | f6de475 | 2013-08-17 00:02:59 +0000 | [diff] [blame] | 649 | SkASSERT(0 == fStencilVerifiedColorConfigs.count()); |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 650 | fStencilVerifiedColorConfigs.push_back_n(fStencilFormats.count()); |
| 651 | } |
| 652 | |
| 653 | void GrGLCaps::markColorConfigAndStencilFormatAsVerified( |
| 654 | GrPixelConfig config, |
| 655 | const GrGLStencilBuffer::Format& format) { |
| 656 | #if !GR_GL_CHECK_FBO_STATUS_ONCE_PER_FORMAT |
| 657 | return; |
| 658 | #endif |
tfarina@chromium.org | f6de475 | 2013-08-17 00:02:59 +0000 | [diff] [blame] | 659 | SkASSERT((unsigned)config < (unsigned)kGrPixelConfigCnt); |
| 660 | SkASSERT(fStencilFormats.count() == fStencilVerifiedColorConfigs.count()); |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 661 | int count = fStencilFormats.count(); |
| 662 | // we expect a really small number of possible formats so linear search |
| 663 | // should be OK |
tfarina@chromium.org | f6de475 | 2013-08-17 00:02:59 +0000 | [diff] [blame] | 664 | SkASSERT(count < 16); |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 665 | for (int i = 0; i < count; ++i) { |
| 666 | if (format.fInternalFormat == |
| 667 | fStencilFormats[i].fInternalFormat) { |
| 668 | fStencilVerifiedColorConfigs[i].markVerified(config); |
| 669 | return; |
| 670 | } |
| 671 | } |
commit-bot@chromium.org | 88cb22b | 2014-04-30 14:17:00 +0000 | [diff] [blame] | 672 | SkFAIL("Why are we seeing a stencil format that " |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 673 | "GrGLCaps doesn't know about."); |
| 674 | } |
| 675 | |
| 676 | bool GrGLCaps::isColorConfigAndStencilFormatVerified( |
| 677 | GrPixelConfig config, |
| 678 | const GrGLStencilBuffer::Format& format) const { |
| 679 | #if !GR_GL_CHECK_FBO_STATUS_ONCE_PER_FORMAT |
| 680 | return false; |
| 681 | #endif |
tfarina@chromium.org | f6de475 | 2013-08-17 00:02:59 +0000 | [diff] [blame] | 682 | SkASSERT((unsigned)config < (unsigned)kGrPixelConfigCnt); |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 683 | int count = fStencilFormats.count(); |
| 684 | // we expect a really small number of possible formats so linear search |
| 685 | // should be OK |
tfarina@chromium.org | f6de475 | 2013-08-17 00:02:59 +0000 | [diff] [blame] | 686 | SkASSERT(count < 16); |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 687 | for (int i = 0; i < count; ++i) { |
| 688 | if (format.fInternalFormat == |
| 689 | fStencilFormats[i].fInternalFormat) { |
| 690 | return fStencilVerifiedColorConfigs[i].isVerified(config); |
| 691 | } |
| 692 | } |
commit-bot@chromium.org | 88cb22b | 2014-04-30 14:17:00 +0000 | [diff] [blame] | 693 | SkFAIL("Why are we seeing a stencil format that " |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 694 | "GLCaps doesn't know about."); |
| 695 | return false; |
| 696 | } |
| 697 | |
commit-bot@chromium.org | 8b656c6 | 2013-11-21 15:23:15 +0000 | [diff] [blame] | 698 | SkString GrGLCaps::dump() const { |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 699 | |
commit-bot@chromium.org | 8b656c6 | 2013-11-21 15:23:15 +0000 | [diff] [blame] | 700 | SkString r = INHERITED::dump(); |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 701 | |
commit-bot@chromium.org | 8b656c6 | 2013-11-21 15:23:15 +0000 | [diff] [blame] | 702 | r.appendf("--- GL-Specific ---\n"); |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 703 | for (int i = 0; i < fStencilFormats.count(); ++i) { |
commit-bot@chromium.org | 8b656c6 | 2013-11-21 15:23:15 +0000 | [diff] [blame] | 704 | r.appendf("Stencil Format %d, stencil bits: %02d, total bits: %02d\n", |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 705 | i, |
| 706 | fStencilFormats[i].fStencilBits, |
| 707 | fStencilFormats[i].fTotalBits); |
| 708 | } |
| 709 | |
bsalomon@google.com | 6b0cf02 | 2013-05-03 13:35:14 +0000 | [diff] [blame] | 710 | static const char* kMSFBOExtStr[] = { |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 711 | "None", |
| 712 | "ARB", |
| 713 | "EXT", |
commit-bot@chromium.org | a8e5a06 | 2013-09-05 23:44:09 +0000 | [diff] [blame] | 714 | "ES 3.0", |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 715 | "Apple", |
bsalomon@google.com | 347c382 | 2013-05-01 20:10:01 +0000 | [diff] [blame] | 716 | "IMG MS To Texture", |
| 717 | "EXT MS To Texture", |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 718 | }; |
bsalomon@google.com | 6b0cf02 | 2013-05-03 13:35:14 +0000 | [diff] [blame] | 719 | GR_STATIC_ASSERT(0 == kNone_MSFBOType); |
| 720 | GR_STATIC_ASSERT(1 == kDesktop_ARB_MSFBOType); |
| 721 | GR_STATIC_ASSERT(2 == kDesktop_EXT_MSFBOType); |
commit-bot@chromium.org | a8e5a06 | 2013-09-05 23:44:09 +0000 | [diff] [blame] | 722 | GR_STATIC_ASSERT(3 == kES_3_0_MSFBOType); |
| 723 | GR_STATIC_ASSERT(4 == kES_Apple_MSFBOType); |
| 724 | GR_STATIC_ASSERT(5 == kES_IMG_MsToTexture_MSFBOType); |
| 725 | GR_STATIC_ASSERT(6 == kES_EXT_MsToTexture_MSFBOType); |
commit-bot@chromium.org | 972f9cd | 2014-03-28 17:58:28 +0000 | [diff] [blame] | 726 | GR_STATIC_ASSERT(SK_ARRAY_COUNT(kMSFBOExtStr) == kLast_MSFBOType + 1); |
bsalomon@google.com | 6b0cf02 | 2013-05-03 13:35:14 +0000 | [diff] [blame] | 727 | |
| 728 | static const char* kFBFetchTypeStr[] = { |
| 729 | "None", |
| 730 | "EXT", |
| 731 | "NV", |
| 732 | }; |
| 733 | GR_STATIC_ASSERT(0 == kNone_FBFetchType); |
| 734 | GR_STATIC_ASSERT(1 == kEXT_FBFetchType); |
| 735 | GR_STATIC_ASSERT(2 == kNV_FBFetchType); |
commit-bot@chromium.org | 972f9cd | 2014-03-28 17:58:28 +0000 | [diff] [blame] | 736 | GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFBFetchTypeStr) == kLast_FBFetchType + 1); |
bsalomon@google.com | 6b0cf02 | 2013-05-03 13:35:14 +0000 | [diff] [blame] | 737 | |
commit-bot@chromium.org | 52ffbf6 | 2014-04-02 16:19:33 +0000 | [diff] [blame] | 738 | static const char* kInvalidateFBTypeStr[] = { |
| 739 | "None", |
| 740 | "Discard", |
| 741 | "Invalidate", |
| 742 | }; |
| 743 | GR_STATIC_ASSERT(0 == kNone_InvalidateFBType); |
| 744 | GR_STATIC_ASSERT(1 == kDiscard_InvalidateFBType); |
| 745 | GR_STATIC_ASSERT(2 == kInvalidate_InvalidateFBType); |
| 746 | GR_STATIC_ASSERT(SK_ARRAY_COUNT(kInvalidateFBTypeStr) == kLast_InvalidateFBType + 1); |
bsalomon@google.com | 6b0cf02 | 2013-05-03 13:35:14 +0000 | [diff] [blame] | 747 | |
commit-bot@chromium.org | 160b478 | 2014-05-05 12:32:37 +0000 | [diff] [blame] | 748 | static const char* kMapBufferTypeStr[] = { |
| 749 | "None", |
| 750 | "MapBuffer", |
| 751 | "MapBufferRange", |
| 752 | "Chromium", |
| 753 | }; |
| 754 | GR_STATIC_ASSERT(0 == kNone_MapBufferType); |
| 755 | GR_STATIC_ASSERT(1 == kMapBuffer_MapBufferType); |
| 756 | GR_STATIC_ASSERT(2 == kMapBufferRange_MapBufferType); |
| 757 | GR_STATIC_ASSERT(3 == kChromium_MapBufferType); |
| 758 | GR_STATIC_ASSERT(SK_ARRAY_COUNT(kMapBufferTypeStr) == kLast_MapBufferType + 1); |
| 759 | |
commit-bot@chromium.org | 8b656c6 | 2013-11-21 15:23:15 +0000 | [diff] [blame] | 760 | r.appendf("Core Profile: %s\n", (fIsCoreProfile ? "YES" : "NO")); |
commit-bot@chromium.org | 8b656c6 | 2013-11-21 15:23:15 +0000 | [diff] [blame] | 761 | r.appendf("MSAA Type: %s\n", kMSFBOExtStr[fMSFBOType]); |
| 762 | r.appendf("FB Fetch Type: %s\n", kFBFetchTypeStr[fFBFetchType]); |
commit-bot@chromium.org | 52ffbf6 | 2014-04-02 16:19:33 +0000 | [diff] [blame] | 763 | r.appendf("Invalidate FB Type: %s\n", kInvalidateFBTypeStr[fInvalidateFBType]); |
commit-bot@chromium.org | 160b478 | 2014-05-05 12:32:37 +0000 | [diff] [blame] | 764 | r.appendf("Map Buffer Type: %s\n", kMapBufferTypeStr[fMapBufferType]); |
commit-bot@chromium.org | 8b656c6 | 2013-11-21 15:23:15 +0000 | [diff] [blame] | 765 | r.appendf("Max FS Uniform Vectors: %d\n", fMaxFragmentUniformVectors); |
| 766 | r.appendf("Max FS Texture Units: %d\n", fMaxFragmentTextureUnits); |
commit-bot@chromium.org | 0a6fe71 | 2014-04-23 19:26:26 +0000 | [diff] [blame] | 767 | if (!fIsCoreProfile) { |
commit-bot@chromium.org | 8b656c6 | 2013-11-21 15:23:15 +0000 | [diff] [blame] | 768 | r.appendf("Max Fixed Function Texture Coords: %d\n", fMaxFixedFunctionTextureCoords); |
commit-bot@chromium.org | 3628ad9 | 2013-08-30 19:43:47 +0000 | [diff] [blame] | 769 | } |
commit-bot@chromium.org | 8b656c6 | 2013-11-21 15:23:15 +0000 | [diff] [blame] | 770 | r.appendf("Max Vertex Attributes: %d\n", fMaxVertexAttributes); |
| 771 | r.appendf("Support RGBA8 Render Buffer: %s\n", (fRGBA8RenderbufferSupport ? "YES": "NO")); |
commit-bot@chromium.org | 8b656c6 | 2013-11-21 15:23:15 +0000 | [diff] [blame] | 772 | r.appendf("BGRA is an internal format: %s\n", (fBGRAIsInternalFormat ? "YES": "NO")); |
| 773 | r.appendf("Support texture swizzle: %s\n", (fTextureSwizzleSupport ? "YES": "NO")); |
| 774 | r.appendf("Unpack Row length support: %s\n", (fUnpackRowLengthSupport ? "YES": "NO")); |
| 775 | r.appendf("Unpack Flip Y support: %s\n", (fUnpackFlipYSupport ? "YES": "NO")); |
| 776 | r.appendf("Pack Row length support: %s\n", (fPackRowLengthSupport ? "YES": "NO")); |
| 777 | r.appendf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO")); |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 778 | |
commit-bot@chromium.org | 8b656c6 | 2013-11-21 15:23:15 +0000 | [diff] [blame] | 779 | r.appendf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO")); |
| 780 | r.appendf("Texture Storage support: %s\n", (fTexStorageSupport ? "YES": "NO")); |
| 781 | r.appendf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); |
| 782 | r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); |
| 783 | r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); |
| 784 | r.appendf("Fragment coord conventions support: %s\n", |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 785 | (fFragCoordsConventionSupport ? "YES": "NO")); |
commit-bot@chromium.org | 8b656c6 | 2013-11-21 15:23:15 +0000 | [diff] [blame] | 786 | r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO")); |
| 787 | r.appendf("Use non-VBO for dynamic data: %s\n", |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 788 | (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); |
commit-bot@chromium.org | 8b656c6 | 2013-11-21 15:23:15 +0000 | [diff] [blame] | 789 | r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO")); |
commit-bot@chromium.org | 4362a38 | 2014-03-26 19:49:03 +0000 | [diff] [blame] | 790 | r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES" : "NO")); |
commit-bot@chromium.org | 8b656c6 | 2013-11-21 15:23:15 +0000 | [diff] [blame] | 791 | return r; |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 792 | } |