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 | |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 14 | SK_DEFINE_INST_COUNT(GrGLCaps) |
| 15 | |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 16 | GrGLCaps::GrGLCaps() { |
| 17 | this->reset(); |
| 18 | } |
| 19 | |
| 20 | void GrGLCaps::reset() { |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 21 | INHERITED::reset(); |
| 22 | |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 23 | fVerifiedColorConfigs.reset(); |
| 24 | fStencilFormats.reset(); |
| 25 | fStencilVerifiedColorConfigs.reset(); |
| 26 | fMSFBOType = kNone_MSFBOType; |
bsalomon@google.com | c9668ec | 2012-04-11 18:16:41 +0000 | [diff] [blame] | 27 | fCoverageAAType = kNone_CoverageAAType; |
bsalomon@google.com | 6b0cf02 | 2013-05-03 13:35:14 +0000 | [diff] [blame] | 28 | fFBFetchType = kNone_FBFetchType; |
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; |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 32 | fRGBA8RenderbufferSupport = false; |
| 33 | fBGRAFormatSupport = false; |
| 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 | a6ffb58 | 2013-04-29 16:50:17 +0000 | [diff] [blame] | 49 | fDiscardFBSupport = false; |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 50 | } |
| 51 | |
bsalomon@google.com | c26d94f | 2013-03-25 18:19:00 +0000 | [diff] [blame] | 52 | GrGLCaps::GrGLCaps(const GrGLCaps& caps) : GrDrawTargetCaps() { |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 53 | *this = caps; |
| 54 | } |
| 55 | |
| 56 | GrGLCaps& GrGLCaps::operator = (const GrGLCaps& caps) { |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 57 | INHERITED::operator=(caps); |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 58 | fVerifiedColorConfigs = caps.fVerifiedColorConfigs; |
| 59 | fStencilFormats = caps.fStencilFormats; |
| 60 | fStencilVerifiedColorConfigs = caps.fStencilVerifiedColorConfigs; |
| 61 | fMaxFragmentUniformVectors = caps.fMaxFragmentUniformVectors; |
bsalomon@google.com | 60da417 | 2012-06-01 19:25:00 +0000 | [diff] [blame] | 62 | fMaxVertexAttributes = caps.fMaxVertexAttributes; |
commit-bot@chromium.org | a15f7e5 | 2013-06-05 23:29:25 +0000 | [diff] [blame] | 63 | fMaxFragmentTextureUnits = caps.fMaxFragmentTextureUnits; |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 64 | fMSFBOType = caps.fMSFBOType; |
bsalomon@google.com | c9668ec | 2012-04-11 18:16:41 +0000 | [diff] [blame] | 65 | fCoverageAAType = caps.fCoverageAAType; |
| 66 | fMSAACoverageModes = caps.fMSAACoverageModes; |
bsalomon@google.com | 6b0cf02 | 2013-05-03 13:35:14 +0000 | [diff] [blame] | 67 | fFBFetchType = caps.fFBFetchType; |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 68 | fRGBA8RenderbufferSupport = caps.fRGBA8RenderbufferSupport; |
| 69 | fBGRAFormatSupport = caps.fBGRAFormatSupport; |
| 70 | fBGRAIsInternalFormat = caps.fBGRAIsInternalFormat; |
| 71 | fTextureSwizzleSupport = caps.fTextureSwizzleSupport; |
| 72 | fUnpackRowLengthSupport = caps.fUnpackRowLengthSupport; |
| 73 | fUnpackFlipYSupport = caps.fUnpackFlipYSupport; |
| 74 | fPackRowLengthSupport = caps.fPackRowLengthSupport; |
| 75 | fPackFlipYSupport = caps.fPackFlipYSupport; |
| 76 | fTextureUsageSupport = caps.fTextureUsageSupport; |
| 77 | fTexStorageSupport = caps.fTexStorageSupport; |
robertphillips@google.com | 443e5a5 | 2012-04-30 20:01:21 +0000 | [diff] [blame] | 78 | fTextureRedSupport = caps.fTextureRedSupport; |
bsalomon@google.com | e76b7cc | 2012-06-18 12:47:06 +0000 | [diff] [blame] | 79 | fImagingSupport = caps.fImagingSupport; |
robertphillips@google.com | 1d89c93 | 2012-06-27 19:31:41 +0000 | [diff] [blame] | 80 | fTwoFormatLimit = caps.fTwoFormatLimit; |
bsalomon@google.com | 706f668 | 2012-10-23 14:53:55 +0000 | [diff] [blame] | 81 | fFragCoordsConventionSupport = caps.fFragCoordsConventionSupport; |
bsalomon@google.com | 07631cf | 2013-03-05 14:14:58 +0000 | [diff] [blame] | 82 | fVertexArrayObjectSupport = caps.fVertexArrayObjectSupport; |
bsalomon@google.com | 96966a5 | 2013-02-21 16:34:21 +0000 | [diff] [blame] | 83 | fUseNonVBOVertexAndIndexDynamicData = caps.fUseNonVBOVertexAndIndexDynamicData; |
bsalomon@google.com | 2b1b8c0 | 2013-02-28 22:06:02 +0000 | [diff] [blame] | 84 | fIsCoreProfile = caps.fIsCoreProfile; |
robertphillips@google.com | a6ffb58 | 2013-04-29 16:50:17 +0000 | [diff] [blame] | 85 | fDiscardFBSupport = caps.fDiscardFBSupport; |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 86 | |
| 87 | return *this; |
| 88 | } |
| 89 | |
robertphillips@google.com | 6177e69 | 2013-02-28 20:16:25 +0000 | [diff] [blame] | 90 | void GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) { |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 91 | |
| 92 | this->reset(); |
| 93 | if (!ctxInfo.isInitialized()) { |
| 94 | return; |
| 95 | } |
| 96 | |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 97 | GrGLBinding binding = ctxInfo.binding(); |
| 98 | GrGLVersion version = ctxInfo.version(); |
| 99 | |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 100 | /************************************************************************** |
| 101 | * Caps specific to GrGLCaps |
| 102 | **************************************************************************/ |
| 103 | |
bsalomon@google.com | 791816a | 2013-08-15 18:54:39 +0000 | [diff] [blame] | 104 | if (kES_GrGLBinding == binding) { |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 105 | GR_GL_GetIntegerv(gli, GR_GL_MAX_FRAGMENT_UNIFORM_VECTORS, |
| 106 | &fMaxFragmentUniformVectors); |
| 107 | } else { |
| 108 | GrAssert(kDesktop_GrGLBinding == binding); |
| 109 | GrGLint max; |
| 110 | GR_GL_GetIntegerv(gli, GR_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &max); |
| 111 | fMaxFragmentUniformVectors = max / 4; |
| 112 | } |
bsalomon@google.com | 60da417 | 2012-06-01 19:25:00 +0000 | [diff] [blame] | 113 | GR_GL_GetIntegerv(gli, GR_GL_MAX_VERTEX_ATTRIBS, &fMaxVertexAttributes); |
commit-bot@chromium.org | a15f7e5 | 2013-06-05 23:29:25 +0000 | [diff] [blame] | 114 | GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_IMAGE_UNITS, &fMaxFragmentTextureUnits); |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 115 | |
| 116 | if (kDesktop_GrGLBinding == binding) { |
| 117 | fRGBA8RenderbufferSupport = true; |
| 118 | } else { |
| 119 | fRGBA8RenderbufferSupport = ctxInfo.hasExtension("GL_OES_rgb8_rgba8") || |
| 120 | ctxInfo.hasExtension("GL_ARM_rgba8"); |
| 121 | } |
| 122 | |
| 123 | if (kDesktop_GrGLBinding == binding) { |
| 124 | fBGRAFormatSupport = version >= GR_GL_VER(1,2) || |
| 125 | ctxInfo.hasExtension("GL_EXT_bgra"); |
| 126 | } else { |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 127 | if (ctxInfo.hasExtension("GL_APPLE_texture_format_BGRA8888")) { |
| 128 | fBGRAFormatSupport = true; |
| 129 | } else if (ctxInfo.hasExtension("GL_EXT_texture_format_BGRA8888")) { |
| 130 | fBGRAFormatSupport = true; |
| 131 | fBGRAIsInternalFormat = true; |
| 132 | } |
| 133 | GrAssert(fBGRAFormatSupport || |
bsalomon@google.com | 0342a85 | 2012-08-20 19:22:38 +0000 | [diff] [blame] | 134 | kSkia8888_GrPixelConfig != kBGRA_8888_GrPixelConfig); |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 135 | } |
| 136 | |
| 137 | if (kDesktop_GrGLBinding == binding) { |
| 138 | fTextureSwizzleSupport = version >= GR_GL_VER(3,3) || |
| 139 | ctxInfo.hasExtension("GL_ARB_texture_swizzle"); |
| 140 | } else { |
| 141 | fTextureSwizzleSupport = false; |
| 142 | } |
| 143 | |
| 144 | if (kDesktop_GrGLBinding == binding) { |
| 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 | |
bsalomon@google.com | 791816a | 2013-08-15 18:54:39 +0000 | [diff] [blame] | 159 | fTextureUsageSupport = (kES_GrGLBinding == binding) && |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 160 | ctxInfo.hasExtension("GL_ANGLE_texture_usage"); |
| 161 | |
| 162 | // Tex storage is in desktop 4.2 and can be an extension to desktop or ES. |
| 163 | fTexStorageSupport = (kDesktop_GrGLBinding == binding && |
| 164 | version >= GR_GL_VER(4,2)) || |
| 165 | ctxInfo.hasExtension("GL_ARB_texture_storage") || |
| 166 | ctxInfo.hasExtension("GL_EXT_texture_storage"); |
| 167 | |
commit-bot@chromium.org | 459104c | 2013-06-14 14:42:56 +0000 | [diff] [blame] | 168 | // ARB_texture_rg is part of OpenGL 3.0, but mesa doesn't support it if |
| 169 | // it doesn't have ARB_texture_rg extension. |
robertphillips@google.com | 443e5a5 | 2012-04-30 20:01:21 +0000 | [diff] [blame] | 170 | if (kDesktop_GrGLBinding == binding) { |
commit-bot@chromium.org | 459104c | 2013-06-14 14:42:56 +0000 | [diff] [blame] | 171 | if (ctxInfo.isMesa()) { |
| 172 | fTextureRedSupport = ctxInfo.hasExtension("GL_ARB_texture_rg"); |
| 173 | } else { |
| 174 | fTextureRedSupport = version >= GR_GL_VER(3,0) || |
| 175 | ctxInfo.hasExtension("GL_ARB_texture_rg"); |
| 176 | } |
robertphillips@google.com | 443e5a5 | 2012-04-30 20:01:21 +0000 | [diff] [blame] | 177 | } else { |
| 178 | fTextureRedSupport = ctxInfo.hasExtension("GL_EXT_texture_rg"); |
| 179 | } |
| 180 | |
bsalomon@google.com | e76b7cc | 2012-06-18 12:47:06 +0000 | [diff] [blame] | 181 | fImagingSupport = kDesktop_GrGLBinding == binding && |
| 182 | ctxInfo.hasExtension("GL_ARB_imaging"); |
| 183 | |
robertphillips@google.com | 1d89c93 | 2012-06-27 19:31:41 +0000 | [diff] [blame] | 184 | // ES 2 only guarantees RGBA/uchar + one other format/type combo for |
| 185 | // ReadPixels. The other format has to checked at run-time since it |
| 186 | // can change based on which render target is bound |
bsalomon@google.com | 791816a | 2013-08-15 18:54:39 +0000 | [diff] [blame] | 187 | fTwoFormatLimit = kES_GrGLBinding == binding; |
robertphillips@google.com | 1d89c93 | 2012-06-27 19:31:41 +0000 | [diff] [blame] | 188 | |
bsalomon@google.com | 706f668 | 2012-10-23 14:53:55 +0000 | [diff] [blame] | 189 | // Known issue on at least some Intel platforms: |
| 190 | // http://code.google.com/p/skia/issues/detail?id=946 |
| 191 | if (kIntel_GrGLVendor != ctxInfo.vendor()) { |
| 192 | fFragCoordsConventionSupport = ctxInfo.glslGeneration() >= k150_GrGLSLGeneration || |
| 193 | ctxInfo.hasExtension("GL_ARB_fragment_coord_conventions"); |
| 194 | } |
| 195 | |
bsalomon@google.com | 3012ded | 2013-02-22 16:44:04 +0000 | [diff] [blame] | 196 | // SGX and Mali GPUs that are based on a tiled-deferred architecture that have trouble with |
| 197 | // frequently changing VBOs. We've measured a performance increase using non-VBO vertex |
| 198 | // data for dynamic content on these GPUs. Perhaps we should read the renderer string and |
| 199 | // limit this decision to specific GPU families rather than basing it on the vendor alone. |
| 200 | if (!GR_GL_MUST_USE_VBO && |
| 201 | (kARM_GrGLVendor == ctxInfo.vendor() || kImagination_GrGLVendor == ctxInfo.vendor())) { |
bsalomon@google.com | 96966a5 | 2013-02-21 16:34:21 +0000 | [diff] [blame] | 202 | fUseNonVBOVertexAndIndexDynamicData = true; |
| 203 | } |
skia.committer@gmail.com | 631cdcb | 2013-03-01 12:12:55 +0000 | [diff] [blame] | 204 | |
bsalomon@google.com | 2b1b8c0 | 2013-02-28 22:06:02 +0000 | [diff] [blame] | 205 | if (kDesktop_GrGLBinding == binding && version >= GR_GL_VER(3, 2)) { |
| 206 | GrGLint profileMask; |
| 207 | GR_GL_GetIntegerv(gli, GR_GL_CONTEXT_PROFILE_MASK, &profileMask); |
| 208 | fIsCoreProfile = SkToBool(profileMask & GR_GL_CONTEXT_CORE_PROFILE_BIT); |
| 209 | } |
bsalomon@google.com | 96966a5 | 2013-02-21 16:34:21 +0000 | [diff] [blame] | 210 | |
robertphillips@google.com | a6ffb58 | 2013-04-29 16:50:17 +0000 | [diff] [blame] | 211 | fDiscardFBSupport = ctxInfo.hasExtension("GL_EXT_discard_framebuffer"); |
| 212 | |
bsalomon@google.com | 07631cf | 2013-03-05 14:14:58 +0000 | [diff] [blame] | 213 | if (kDesktop_GrGLBinding == binding) { |
| 214 | fVertexArrayObjectSupport = version >= GR_GL_VER(3, 0) || |
| 215 | ctxInfo.hasExtension("GL_ARB_vertex_array_object"); |
| 216 | } else { |
commit-bot@chromium.org | 2276c01 | 2013-08-16 15:53:33 +0000 | [diff] [blame] | 217 | fVertexArrayObjectSupport = version >= GR_GL_VER(3, 0) || |
| 218 | ctxInfo.hasExtension("GL_OES_vertex_array_object"); |
bsalomon@google.com | 07631cf | 2013-03-05 14:14:58 +0000 | [diff] [blame] | 219 | } |
| 220 | |
bsalomon@google.com | 791816a | 2013-08-15 18:54:39 +0000 | [diff] [blame] | 221 | if (kES_GrGLBinding == binding) { |
bsalomon@google.com | 6b0cf02 | 2013-05-03 13:35:14 +0000 | [diff] [blame] | 222 | if (ctxInfo.hasExtension("GL_EXT_shader_framebuffer_fetch")) { |
| 223 | fFBFetchType = kEXT_FBFetchType; |
| 224 | } else if (ctxInfo.hasExtension("GL_NV_shader_framebuffer_fetch")) { |
| 225 | fFBFetchType = kNV_FBFetchType; |
| 226 | } |
| 227 | } |
| 228 | |
robertphillips@google.com | 6177e69 | 2013-02-28 20:16:25 +0000 | [diff] [blame] | 229 | this->initFSAASupport(ctxInfo, gli); |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 230 | this->initStencilFormats(ctxInfo); |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 231 | |
| 232 | /************************************************************************** |
bsalomon@google.com | c26d94f | 2013-03-25 18:19:00 +0000 | [diff] [blame] | 233 | * GrDrawTargetCaps fields |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 234 | **************************************************************************/ |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 235 | GrGLint numFormats; |
| 236 | GR_GL_GetIntegerv(gli, GR_GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numFormats); |
bungeman@google.com | 7103344 | 2013-05-01 14:21:20 +0000 | [diff] [blame] | 237 | if (numFormats) { |
| 238 | SkAutoSTMalloc<10, GrGLint> formats(numFormats); |
| 239 | GR_GL_GetIntegerv(gli, GR_GL_COMPRESSED_TEXTURE_FORMATS, formats); |
| 240 | for (int i = 0; i < numFormats; ++i) { |
| 241 | if (formats[i] == GR_GL_PALETTE8_RGBA8) { |
| 242 | f8BitPaletteSupport = true; |
| 243 | break; |
| 244 | } |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 245 | } |
| 246 | } |
| 247 | |
| 248 | if (kDesktop_GrGLBinding == binding) { |
| 249 | // we could also look for GL_ATI_separate_stencil extension or |
| 250 | // GL_EXT_stencil_two_side but they use different function signatures |
| 251 | // than GL2.0+ (and than each other). |
| 252 | fTwoSidedStencilSupport = (ctxInfo.version() >= GR_GL_VER(2,0)); |
| 253 | // supported on GL 1.4 and higher or by extension |
| 254 | fStencilWrapOpsSupport = (ctxInfo.version() >= GR_GL_VER(1,4)) || |
| 255 | ctxInfo.hasExtension("GL_EXT_stencil_wrap"); |
| 256 | } else { |
| 257 | // ES 2 has two sided stencil and stencil wrap |
| 258 | fTwoSidedStencilSupport = true; |
| 259 | fStencilWrapOpsSupport = true; |
| 260 | } |
| 261 | |
| 262 | if (kDesktop_GrGLBinding == binding) { |
| 263 | fBufferLockSupport = true; // we require VBO support and the desktop VBO extension includes |
| 264 | // glMapBuffer. |
| 265 | } else { |
| 266 | fBufferLockSupport = ctxInfo.hasExtension("GL_OES_mapbuffer"); |
| 267 | } |
| 268 | |
| 269 | if (kDesktop_GrGLBinding == binding) { |
| 270 | if (ctxInfo.version() >= GR_GL_VER(2,0) || |
| 271 | ctxInfo.hasExtension("GL_ARB_texture_non_power_of_two")) { |
| 272 | fNPOTTextureTileSupport = true; |
| 273 | } else { |
| 274 | fNPOTTextureTileSupport = false; |
| 275 | } |
| 276 | } else { |
| 277 | // 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^] | 278 | // ES3 has no limitations. |
| 279 | fNPOTTextureTileSupport = ctxInfo.version() >= GR_GL_VER(3,0) || |
| 280 | ctxInfo.hasExtension("GL_OES_texture_npot"); |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 281 | } |
| 282 | |
| 283 | fHWAALineSupport = (kDesktop_GrGLBinding == binding); |
| 284 | |
| 285 | GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_SIZE, &fMaxTextureSize); |
| 286 | GR_GL_GetIntegerv(gli, GR_GL_MAX_RENDERBUFFER_SIZE, &fMaxRenderTargetSize); |
| 287 | // Our render targets are always created with textures as the color |
| 288 | // attachment, hence this min: |
| 289 | fMaxRenderTargetSize = GrMin(fMaxTextureSize, fMaxRenderTargetSize); |
| 290 | |
| 291 | fPathStencilingSupport = GR_GL_USE_NV_PATH_RENDERING && |
| 292 | ctxInfo.hasExtension("GL_NV_path_rendering"); |
| 293 | |
bsalomon@google.com | 6b0cf02 | 2013-05-03 13:35:14 +0000 | [diff] [blame] | 294 | fDstReadInShaderSupport = kNone_FBFetchType != fFBFetchType; |
| 295 | |
robertphillips@google.com | e4eaea2 | 2013-07-19 16:51:46 +0000 | [diff] [blame] | 296 | #if 0 |
| 297 | // This has to be temporarily disabled. On Android it causes the texture |
| 298 | // usage to become front loaded and the OS kills the process. It can |
| 299 | // be re-enabled once the more dynamic (ref-driven) cache clearing |
| 300 | // system is in place. |
commit-bot@chromium.org | b835652 | 2013-07-18 22:26:39 +0000 | [diff] [blame] | 301 | fReuseScratchTextures = kARM_GrGLVendor != ctxInfo.vendor(); |
robertphillips@google.com | e4eaea2 | 2013-07-19 16:51:46 +0000 | [diff] [blame] | 302 | #else |
| 303 | fReuseScratchTextures = true; |
| 304 | #endif |
commit-bot@chromium.org | b835652 | 2013-07-18 22:26:39 +0000 | [diff] [blame] | 305 | |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 306 | // Enable supported shader-related caps |
| 307 | if (kDesktop_GrGLBinding == binding) { |
| 308 | fDualSourceBlendingSupport = ctxInfo.version() >= GR_GL_VER(3,3) || |
| 309 | ctxInfo.hasExtension("GL_ARB_blend_func_extended"); |
| 310 | fShaderDerivativeSupport = true; |
| 311 | // we don't support GL_ARB_geometry_shader4, just GL 3.2+ GS |
| 312 | fGeometryShaderSupport = ctxInfo.version() >= GR_GL_VER(3,2) && |
| 313 | ctxInfo.glslGeneration() >= k150_GrGLSLGeneration; |
| 314 | } else { |
| 315 | fShaderDerivativeSupport = ctxInfo.hasExtension("GL_OES_standard_derivatives"); |
| 316 | } |
| 317 | |
bsalomon@google.com | 347c382 | 2013-05-01 20:10:01 +0000 | [diff] [blame] | 318 | if (GrGLCaps::kES_IMG_MsToTexture_MSFBOType == fMSFBOType) { |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 319 | GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES_IMG, &fMaxSampleCount); |
| 320 | } else if (GrGLCaps::kNone_MSFBOType != fMSFBOType) { |
| 321 | GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES, &fMaxSampleCount); |
| 322 | } |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 323 | } |
| 324 | |
robertphillips@google.com | 1d89c93 | 2012-06-27 19:31:41 +0000 | [diff] [blame] | 325 | bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf, |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 326 | GrGLenum format, |
| 327 | GrGLenum type) const { |
robertphillips@google.com | 1d89c93 | 2012-06-27 19:31:41 +0000 | [diff] [blame] | 328 | if (GR_GL_RGBA == format && GR_GL_UNSIGNED_BYTE == type) { |
| 329 | // ES 2 guarantees this format is supported |
robertphillips@google.com | eca2dfb | 2012-06-27 20:13:49 +0000 | [diff] [blame] | 330 | return true; |
robertphillips@google.com | 1d89c93 | 2012-06-27 19:31:41 +0000 | [diff] [blame] | 331 | } |
| 332 | |
| 333 | if (!fTwoFormatLimit) { |
| 334 | // not limited by ES 2's constraints |
| 335 | return true; |
| 336 | } |
| 337 | |
bsalomon@google.com | 548a433 | 2012-07-11 19:45:22 +0000 | [diff] [blame] | 338 | GrGLint otherFormat = GR_GL_RGBA; |
| 339 | GrGLint otherType = GR_GL_UNSIGNED_BYTE; |
robertphillips@google.com | 1d89c93 | 2012-06-27 19:31:41 +0000 | [diff] [blame] | 340 | |
| 341 | // The other supported format/type combo supported for ReadPixels |
| 342 | // can change based on which render target is bound |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 343 | GR_GL_GetIntegerv(intf, |
robertphillips@google.com | 1d89c93 | 2012-06-27 19:31:41 +0000 | [diff] [blame] | 344 | GR_GL_IMPLEMENTATION_COLOR_READ_FORMAT, |
| 345 | &otherFormat); |
| 346 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 347 | GR_GL_GetIntegerv(intf, |
robertphillips@google.com | 1d89c93 | 2012-06-27 19:31:41 +0000 | [diff] [blame] | 348 | GR_GL_IMPLEMENTATION_COLOR_READ_TYPE, |
| 349 | &otherType); |
| 350 | |
bsalomon@google.com | 548a433 | 2012-07-11 19:45:22 +0000 | [diff] [blame] | 351 | return (GrGLenum)otherFormat == format && (GrGLenum)otherType == type; |
robertphillips@google.com | 1d89c93 | 2012-06-27 19:31:41 +0000 | [diff] [blame] | 352 | } |
| 353 | |
bsalomon@google.com | c9668ec | 2012-04-11 18:16:41 +0000 | [diff] [blame] | 354 | namespace { |
bsalomon@google.com | 20f7f17 | 2013-05-17 19:05:03 +0000 | [diff] [blame] | 355 | bool cov_mode_less(const GrGLCaps::MSAACoverageMode& left, |
| 356 | const GrGLCaps::MSAACoverageMode& right) { |
| 357 | if (left.fCoverageSampleCnt < right.fCoverageSampleCnt) { |
| 358 | return true; |
| 359 | } else if (right.fCoverageSampleCnt < left.fCoverageSampleCnt) { |
| 360 | return false; |
| 361 | } else if (left.fColorSampleCnt < right.fColorSampleCnt) { |
| 362 | return true; |
bsalomon@google.com | c9668ec | 2012-04-11 18:16:41 +0000 | [diff] [blame] | 363 | } |
bsalomon@google.com | 20f7f17 | 2013-05-17 19:05:03 +0000 | [diff] [blame] | 364 | return false; |
bsalomon@google.com | c9668ec | 2012-04-11 18:16:41 +0000 | [diff] [blame] | 365 | } |
| 366 | } |
| 367 | |
robertphillips@google.com | 6177e69 | 2013-02-28 20:16:25 +0000 | [diff] [blame] | 368 | void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) { |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 369 | |
| 370 | fMSFBOType = kNone_MSFBOType; |
| 371 | if (kDesktop_GrGLBinding != ctxInfo.binding()) { |
| 372 | if (ctxInfo.hasExtension("GL_CHROMIUM_framebuffer_multisample")) { |
| 373 | // chrome's extension is equivalent to the EXT msaa |
| 374 | // and fbo_blit extensions. |
bsalomon@google.com | 347c382 | 2013-05-01 20:10:01 +0000 | [diff] [blame] | 375 | fMSFBOType = kDesktop_EXT_MSFBOType; |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 376 | } else if (ctxInfo.hasExtension("GL_APPLE_framebuffer_multisample")) { |
bsalomon@google.com | 347c382 | 2013-05-01 20:10:01 +0000 | [diff] [blame] | 377 | fMSFBOType = kES_Apple_MSFBOType; |
| 378 | } else if (ctxInfo.hasExtension("GL_EXT_multisampled_render_to_texture")) { |
| 379 | fMSFBOType = kES_EXT_MsToTexture_MSFBOType; |
bsalomon@google.com | f3a60c0 | 2013-03-19 19:06:09 +0000 | [diff] [blame] | 380 | } else if (ctxInfo.hasExtension("GL_IMG_multisampled_render_to_texture")) { |
bsalomon@google.com | 347c382 | 2013-05-01 20:10:01 +0000 | [diff] [blame] | 381 | fMSFBOType = kES_IMG_MsToTexture_MSFBOType; |
bsalomon@google.com | c9668ec | 2012-04-11 18:16:41 +0000 | [diff] [blame] | 382 | } |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 383 | } else { |
| 384 | if ((ctxInfo.version() >= GR_GL_VER(3,0)) || |
| 385 | ctxInfo.hasExtension("GL_ARB_framebuffer_object")) { |
bsalomon@google.com | 347c382 | 2013-05-01 20:10:01 +0000 | [diff] [blame] | 386 | fMSFBOType = GrGLCaps::kDesktop_ARB_MSFBOType; |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 387 | } else if (ctxInfo.hasExtension("GL_EXT_framebuffer_multisample") && |
| 388 | ctxInfo.hasExtension("GL_EXT_framebuffer_blit")) { |
bsalomon@google.com | 347c382 | 2013-05-01 20:10:01 +0000 | [diff] [blame] | 389 | fMSFBOType = GrGLCaps::kDesktop_EXT_MSFBOType; |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 390 | } |
bsalomon@google.com | c9668ec | 2012-04-11 18:16:41 +0000 | [diff] [blame] | 391 | // TODO: We could populate fMSAACoverageModes using GetInternalformativ |
| 392 | // on GL 4.2+. It's format-specific, though. See also |
| 393 | // http://code.google.com/p/skia/issues/detail?id=470 about using actual |
| 394 | // rather than requested sample counts in cache key. |
| 395 | if (ctxInfo.hasExtension("GL_NV_framebuffer_multisample_coverage")) { |
| 396 | fCoverageAAType = kNVDesktop_CoverageAAType; |
| 397 | GrGLint count; |
robertphillips@google.com | 6177e69 | 2013-02-28 20:16:25 +0000 | [diff] [blame] | 398 | GR_GL_GetIntegerv(gli, |
bsalomon@google.com | c9668ec | 2012-04-11 18:16:41 +0000 | [diff] [blame] | 399 | GR_GL_MAX_MULTISAMPLE_COVERAGE_MODES, |
| 400 | &count); |
| 401 | fMSAACoverageModes.setCount(count); |
robertphillips@google.com | 6177e69 | 2013-02-28 20:16:25 +0000 | [diff] [blame] | 402 | GR_GL_GetIntegerv(gli, |
bsalomon@google.com | c9668ec | 2012-04-11 18:16:41 +0000 | [diff] [blame] | 403 | GR_GL_MULTISAMPLE_COVERAGE_MODES, |
| 404 | (int*)&fMSAACoverageModes[0]); |
| 405 | // The NV driver seems to return the modes already sorted but the |
| 406 | // spec doesn't require this. So we sort. |
bsalomon@google.com | 20f7f17 | 2013-05-17 19:05:03 +0000 | [diff] [blame] | 407 | typedef SkTLessFunctionToFunctorAdaptor<MSAACoverageMode, cov_mode_less> SortFunctor; |
| 408 | SortFunctor sortFunctor; |
| 409 | SkTQSort<MSAACoverageMode, SortFunctor>(fMSAACoverageModes.begin(), |
| 410 | fMSAACoverageModes.end() - 1, |
| 411 | sortFunctor); |
bsalomon@google.com | c9668ec | 2012-04-11 18:16:41 +0000 | [diff] [blame] | 412 | } |
| 413 | } |
| 414 | } |
| 415 | |
bsalomon@google.com | 8a70eef | 2013-03-19 13:58:55 +0000 | [diff] [blame] | 416 | const GrGLCaps::MSAACoverageMode& GrGLCaps::getMSAACoverageMode(int desiredSampleCount) const { |
bsalomon@google.com | c9668ec | 2012-04-11 18:16:41 +0000 | [diff] [blame] | 417 | static const MSAACoverageMode kNoneMode = {0, 0}; |
| 418 | if (0 == fMSAACoverageModes.count()) { |
| 419 | return kNoneMode; |
| 420 | } else { |
| 421 | GrAssert(kNone_CoverageAAType != fCoverageAAType); |
| 422 | int max = (fMSAACoverageModes.end() - 1)->fCoverageSampleCnt; |
| 423 | desiredSampleCount = GrMin(desiredSampleCount, max); |
| 424 | MSAACoverageMode desiredMode = {desiredSampleCount, 0}; |
bsalomon@google.com | 20f7f17 | 2013-05-17 19:05:03 +0000 | [diff] [blame] | 425 | int idx = SkTSearch<const MSAACoverageMode, cov_mode_less>(&fMSAACoverageModes[0], |
| 426 | fMSAACoverageModes.count(), |
| 427 | desiredMode, |
| 428 | sizeof(MSAACoverageMode)); |
bsalomon@google.com | c9668ec | 2012-04-11 18:16:41 +0000 | [diff] [blame] | 429 | if (idx < 0) { |
| 430 | idx = ~idx; |
| 431 | } |
| 432 | GrAssert(idx >= 0 && idx < fMSAACoverageModes.count()); |
| 433 | return fMSAACoverageModes[idx]; |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 434 | } |
| 435 | } |
| 436 | |
| 437 | namespace { |
| 438 | const GrGLuint kUnknownBitCount = GrGLStencilBuffer::kUnknownBitCount; |
| 439 | } |
| 440 | |
| 441 | void GrGLCaps::initStencilFormats(const GrGLContextInfo& ctxInfo) { |
| 442 | |
| 443 | // Build up list of legal stencil formats (though perhaps not supported on |
| 444 | // the particular gpu/driver) from most preferred to least. |
| 445 | |
| 446 | // these consts are in order of most preferred to least preferred |
| 447 | // we don't bother with GL_STENCIL_INDEX1 or GL_DEPTH32F_STENCIL8 |
| 448 | |
| 449 | static const StencilFormat |
| 450 | // internal Format stencil bits total bits packed? |
| 451 | gS8 = {GR_GL_STENCIL_INDEX8, 8, 8, false}, |
| 452 | gS16 = {GR_GL_STENCIL_INDEX16, 16, 16, false}, |
| 453 | gD24S8 = {GR_GL_DEPTH24_STENCIL8, 8, 32, true }, |
| 454 | gS4 = {GR_GL_STENCIL_INDEX4, 4, 4, false}, |
caryclark@google.com | cf6285b | 2012-06-06 12:09:01 +0000 | [diff] [blame] | 455 | // gS = {GR_GL_STENCIL_INDEX, kUnknownBitCount, kUnknownBitCount, false}, |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 456 | gDS = {GR_GL_DEPTH_STENCIL, kUnknownBitCount, kUnknownBitCount, true }; |
| 457 | |
| 458 | if (kDesktop_GrGLBinding == ctxInfo.binding()) { |
| 459 | bool supportsPackedDS = |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 460 | ctxInfo.version() >= GR_GL_VER(3,0) || |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 461 | ctxInfo.hasExtension("GL_EXT_packed_depth_stencil") || |
| 462 | ctxInfo.hasExtension("GL_ARB_framebuffer_object"); |
| 463 | |
| 464 | // S1 thru S16 formats are in GL 3.0+, EXT_FBO, and ARB_FBO since we |
| 465 | // require FBO support we can expect these are legal formats and don't |
| 466 | // check. These also all support the unsized GL_STENCIL_INDEX. |
| 467 | fStencilFormats.push_back() = gS8; |
| 468 | fStencilFormats.push_back() = gS16; |
| 469 | if (supportsPackedDS) { |
| 470 | fStencilFormats.push_back() = gD24S8; |
| 471 | } |
| 472 | fStencilFormats.push_back() = gS4; |
| 473 | if (supportsPackedDS) { |
| 474 | fStencilFormats.push_back() = gDS; |
| 475 | } |
| 476 | } else { |
| 477 | // ES2 has STENCIL_INDEX8 without extensions but requires extensions |
| 478 | // for other formats. |
| 479 | // ES doesn't support using the unsized format. |
| 480 | |
| 481 | fStencilFormats.push_back() = gS8; |
| 482 | //fStencilFormats.push_back() = gS16; |
| 483 | if (ctxInfo.hasExtension("GL_OES_packed_depth_stencil")) { |
| 484 | fStencilFormats.push_back() = gD24S8; |
| 485 | } |
| 486 | if (ctxInfo.hasExtension("GL_OES_stencil4")) { |
| 487 | fStencilFormats.push_back() = gS4; |
| 488 | } |
| 489 | } |
| 490 | GrAssert(0 == fStencilVerifiedColorConfigs.count()); |
| 491 | fStencilVerifiedColorConfigs.push_back_n(fStencilFormats.count()); |
| 492 | } |
| 493 | |
| 494 | void GrGLCaps::markColorConfigAndStencilFormatAsVerified( |
| 495 | GrPixelConfig config, |
| 496 | const GrGLStencilBuffer::Format& format) { |
| 497 | #if !GR_GL_CHECK_FBO_STATUS_ONCE_PER_FORMAT |
| 498 | return; |
| 499 | #endif |
bsalomon@google.com | b6b72e5 | 2013-03-28 15:11:14 +0000 | [diff] [blame] | 500 | GrAssert((unsigned)config < (unsigned)kGrPixelConfigCnt); |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 501 | GrAssert(fStencilFormats.count() == fStencilVerifiedColorConfigs.count()); |
| 502 | int count = fStencilFormats.count(); |
| 503 | // we expect a really small number of possible formats so linear search |
| 504 | // should be OK |
| 505 | GrAssert(count < 16); |
| 506 | for (int i = 0; i < count; ++i) { |
| 507 | if (format.fInternalFormat == |
| 508 | fStencilFormats[i].fInternalFormat) { |
| 509 | fStencilVerifiedColorConfigs[i].markVerified(config); |
| 510 | return; |
| 511 | } |
| 512 | } |
| 513 | GrCrash("Why are we seeing a stencil format that " |
| 514 | "GrGLCaps doesn't know about."); |
| 515 | } |
| 516 | |
| 517 | bool GrGLCaps::isColorConfigAndStencilFormatVerified( |
| 518 | GrPixelConfig config, |
| 519 | const GrGLStencilBuffer::Format& format) const { |
| 520 | #if !GR_GL_CHECK_FBO_STATUS_ONCE_PER_FORMAT |
| 521 | return false; |
| 522 | #endif |
bsalomon@google.com | b6b72e5 | 2013-03-28 15:11:14 +0000 | [diff] [blame] | 523 | GrAssert((unsigned)config < (unsigned)kGrPixelConfigCnt); |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 524 | int count = fStencilFormats.count(); |
| 525 | // we expect a really small number of possible formats so linear search |
| 526 | // should be OK |
| 527 | GrAssert(count < 16); |
| 528 | for (int i = 0; i < count; ++i) { |
| 529 | if (format.fInternalFormat == |
| 530 | fStencilFormats[i].fInternalFormat) { |
| 531 | return fStencilVerifiedColorConfigs[i].isVerified(config); |
| 532 | } |
| 533 | } |
| 534 | GrCrash("Why are we seeing a stencil format that " |
| 535 | "GLCaps doesn't know about."); |
| 536 | return false; |
| 537 | } |
| 538 | |
| 539 | void GrGLCaps::print() const { |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 540 | |
| 541 | INHERITED::print(); |
| 542 | |
| 543 | GrPrintf("--- GL-Specific ---\n"); |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 544 | for (int i = 0; i < fStencilFormats.count(); ++i) { |
| 545 | GrPrintf("Stencil Format %d, stencil bits: %02d, total bits: %02d\n", |
| 546 | i, |
| 547 | fStencilFormats[i].fStencilBits, |
| 548 | fStencilFormats[i].fTotalBits); |
| 549 | } |
| 550 | |
bsalomon@google.com | 6b0cf02 | 2013-05-03 13:35:14 +0000 | [diff] [blame] | 551 | static const char* kMSFBOExtStr[] = { |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 552 | "None", |
| 553 | "ARB", |
| 554 | "EXT", |
| 555 | "Apple", |
bsalomon@google.com | 347c382 | 2013-05-01 20:10:01 +0000 | [diff] [blame] | 556 | "IMG MS To Texture", |
| 557 | "EXT MS To Texture", |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 558 | }; |
bsalomon@google.com | 6b0cf02 | 2013-05-03 13:35:14 +0000 | [diff] [blame] | 559 | GR_STATIC_ASSERT(0 == kNone_MSFBOType); |
| 560 | GR_STATIC_ASSERT(1 == kDesktop_ARB_MSFBOType); |
| 561 | GR_STATIC_ASSERT(2 == kDesktop_EXT_MSFBOType); |
| 562 | GR_STATIC_ASSERT(3 == kES_Apple_MSFBOType); |
| 563 | GR_STATIC_ASSERT(4 == kES_IMG_MsToTexture_MSFBOType); |
| 564 | GR_STATIC_ASSERT(5 == kES_EXT_MsToTexture_MSFBOType); |
| 565 | GR_STATIC_ASSERT(GR_ARRAY_COUNT(kMSFBOExtStr) == kLast_MSFBOType + 1); |
| 566 | |
| 567 | static const char* kFBFetchTypeStr[] = { |
| 568 | "None", |
| 569 | "EXT", |
| 570 | "NV", |
| 571 | }; |
| 572 | GR_STATIC_ASSERT(0 == kNone_FBFetchType); |
| 573 | GR_STATIC_ASSERT(1 == kEXT_FBFetchType); |
| 574 | GR_STATIC_ASSERT(2 == kNV_FBFetchType); |
| 575 | GR_STATIC_ASSERT(GR_ARRAY_COUNT(kFBFetchTypeStr) == kLast_FBFetchType + 1); |
| 576 | |
| 577 | |
| 578 | GrPrintf("MSAA Type: %s\n", kMSFBOExtStr[fMSFBOType]); |
| 579 | GrPrintf("FB Fetch Type: %s\n", kFBFetchTypeStr[fFBFetchType]); |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 580 | GrPrintf("Max FS Uniform Vectors: %d\n", fMaxFragmentUniformVectors); |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 581 | GrPrintf("Max Vertex Attributes: %d\n", fMaxVertexAttributes); |
| 582 | GrPrintf("Support RGBA8 Render Buffer: %s\n", (fRGBA8RenderbufferSupport ? "YES": "NO")); |
| 583 | GrPrintf("BGRA support: %s\n", (fBGRAFormatSupport ? "YES": "NO")); |
| 584 | GrPrintf("BGRA is an internal format: %s\n", (fBGRAIsInternalFormat ? "YES": "NO")); |
| 585 | GrPrintf("Support texture swizzle: %s\n", (fTextureSwizzleSupport ? "YES": "NO")); |
| 586 | GrPrintf("Unpack Row length support: %s\n", (fUnpackRowLengthSupport ? "YES": "NO")); |
| 587 | GrPrintf("Unpack Flip Y support: %s\n", (fUnpackFlipYSupport ? "YES": "NO")); |
| 588 | GrPrintf("Pack Row length support: %s\n", (fPackRowLengthSupport ? "YES": "NO")); |
| 589 | GrPrintf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO")); |
| 590 | |
| 591 | GrPrintf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO")); |
| 592 | GrPrintf("Texture Storage support: %s\n", (fTexStorageSupport ? "YES": "NO")); |
| 593 | GrPrintf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); |
| 594 | GrPrintf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); |
robertphillips@google.com | 1d89c93 | 2012-06-27 19:31:41 +0000 | [diff] [blame] | 595 | GrPrintf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); |
bsalomon@google.com | bcce892 | 2013-03-25 15:38:39 +0000 | [diff] [blame] | 596 | GrPrintf("Fragment coord conventions support: %s\n", |
| 597 | (fFragCoordsConventionSupport ? "YES": "NO")); |
| 598 | GrPrintf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "YES": "NO")); |
| 599 | GrPrintf("Use non-VBO for dynamic data: %s\n", |
| 600 | (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); |
| 601 | GrPrintf("Core Profile: %s\n", (fIsCoreProfile ? "YES" : "NO")); |
robertphillips@google.com | a6ffb58 | 2013-04-29 16:50:17 +0000 | [diff] [blame] | 602 | GrPrintf("Discard FrameBuffer support: %s\n", (fDiscardFBSupport ? "YES" : "NO")); |
bsalomon@google.com | f7fa806 | 2012-02-14 14:09:57 +0000 | [diff] [blame] | 603 | } |