| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 | 8 |
| 9 #include "GrGLCaps.h" | 9 #include "GrGLCaps.h" |
| 10 #include "GrGLContext.h" | 10 #include "GrGLContext.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 fVerifiedColorConfigs.reset(); | 23 fVerifiedColorConfigs.reset(); |
| 24 fStencilFormats.reset(); | 24 fStencilFormats.reset(); |
| 25 fStencilVerifiedColorConfigs.reset(); | 25 fStencilVerifiedColorConfigs.reset(); |
| 26 fMSFBOType = kNone_MSFBOType; | 26 fMSFBOType = kNone_MSFBOType; |
| 27 fCoverageAAType = kNone_CoverageAAType; | 27 fCoverageAAType = kNone_CoverageAAType; |
| 28 fFBFetchType = kNone_FBFetchType; | 28 fFBFetchType = kNone_FBFetchType; |
| 29 fMaxFragmentUniformVectors = 0; | 29 fMaxFragmentUniformVectors = 0; |
| 30 fMaxVertexAttributes = 0; | 30 fMaxVertexAttributes = 0; |
| 31 fMaxFragmentTextureUnits = 0; | 31 fMaxFragmentTextureUnits = 0; |
| 32 fMaxFixedFunctionTextureCoords = 0; |
| 32 fRGBA8RenderbufferSupport = false; | 33 fRGBA8RenderbufferSupport = false; |
| 33 fBGRAFormatSupport = false; | 34 fBGRAFormatSupport = false; |
| 34 fBGRAIsInternalFormat = false; | 35 fBGRAIsInternalFormat = false; |
| 35 fTextureSwizzleSupport = false; | 36 fTextureSwizzleSupport = false; |
| 36 fUnpackRowLengthSupport = false; | 37 fUnpackRowLengthSupport = false; |
| 37 fUnpackFlipYSupport = false; | 38 fUnpackFlipYSupport = false; |
| 38 fPackRowLengthSupport = false; | 39 fPackRowLengthSupport = false; |
| 39 fPackFlipYSupport = false; | 40 fPackFlipYSupport = false; |
| 40 fTextureUsageSupport = false; | 41 fTextureUsageSupport = false; |
| 41 fTexStorageSupport = false; | 42 fTexStorageSupport = false; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 54 } | 55 } |
| 55 | 56 |
| 56 GrGLCaps& GrGLCaps::operator = (const GrGLCaps& caps) { | 57 GrGLCaps& GrGLCaps::operator = (const GrGLCaps& caps) { |
| 57 INHERITED::operator=(caps); | 58 INHERITED::operator=(caps); |
| 58 fVerifiedColorConfigs = caps.fVerifiedColorConfigs; | 59 fVerifiedColorConfigs = caps.fVerifiedColorConfigs; |
| 59 fStencilFormats = caps.fStencilFormats; | 60 fStencilFormats = caps.fStencilFormats; |
| 60 fStencilVerifiedColorConfigs = caps.fStencilVerifiedColorConfigs; | 61 fStencilVerifiedColorConfigs = caps.fStencilVerifiedColorConfigs; |
| 61 fMaxFragmentUniformVectors = caps.fMaxFragmentUniformVectors; | 62 fMaxFragmentUniformVectors = caps.fMaxFragmentUniformVectors; |
| 62 fMaxVertexAttributes = caps.fMaxVertexAttributes; | 63 fMaxVertexAttributes = caps.fMaxVertexAttributes; |
| 63 fMaxFragmentTextureUnits = caps.fMaxFragmentTextureUnits; | 64 fMaxFragmentTextureUnits = caps.fMaxFragmentTextureUnits; |
| 65 fMaxFixedFunctionTextureCoords = caps.fMaxFixedFunctionTextureCoords; |
| 64 fMSFBOType = caps.fMSFBOType; | 66 fMSFBOType = caps.fMSFBOType; |
| 65 fCoverageAAType = caps.fCoverageAAType; | 67 fCoverageAAType = caps.fCoverageAAType; |
| 66 fMSAACoverageModes = caps.fMSAACoverageModes; | 68 fMSAACoverageModes = caps.fMSAACoverageModes; |
| 67 fFBFetchType = caps.fFBFetchType; | 69 fFBFetchType = caps.fFBFetchType; |
| 68 fRGBA8RenderbufferSupport = caps.fRGBA8RenderbufferSupport; | 70 fRGBA8RenderbufferSupport = caps.fRGBA8RenderbufferSupport; |
| 69 fBGRAFormatSupport = caps.fBGRAFormatSupport; | 71 fBGRAFormatSupport = caps.fBGRAFormatSupport; |
| 70 fBGRAIsInternalFormat = caps.fBGRAIsInternalFormat; | 72 fBGRAIsInternalFormat = caps.fBGRAIsInternalFormat; |
| 71 fTextureSwizzleSupport = caps.fTextureSwizzleSupport; | 73 fTextureSwizzleSupport = caps.fTextureSwizzleSupport; |
| 72 fUnpackRowLengthSupport = caps.fUnpackRowLengthSupport; | 74 fUnpackRowLengthSupport = caps.fUnpackRowLengthSupport; |
| 73 fUnpackFlipYSupport = caps.fUnpackFlipYSupport; | 75 fUnpackFlipYSupport = caps.fUnpackFlipYSupport; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 102 **************************************************************************/ | 104 **************************************************************************/ |
| 103 | 105 |
| 104 if (kES_GrGLBinding == binding) { | 106 if (kES_GrGLBinding == binding) { |
| 105 GR_GL_GetIntegerv(gli, GR_GL_MAX_FRAGMENT_UNIFORM_VECTORS, | 107 GR_GL_GetIntegerv(gli, GR_GL_MAX_FRAGMENT_UNIFORM_VECTORS, |
| 106 &fMaxFragmentUniformVectors); | 108 &fMaxFragmentUniformVectors); |
| 107 } else { | 109 } else { |
| 108 SkASSERT(kDesktop_GrGLBinding == binding); | 110 SkASSERT(kDesktop_GrGLBinding == binding); |
| 109 GrGLint max; | 111 GrGLint max; |
| 110 GR_GL_GetIntegerv(gli, GR_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &max); | 112 GR_GL_GetIntegerv(gli, GR_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &max); |
| 111 fMaxFragmentUniformVectors = max / 4; | 113 fMaxFragmentUniformVectors = max / 4; |
| 114 if (version >= GR_GL_VER(3, 2)) { |
| 115 GrGLint profileMask; |
| 116 GR_GL_GetIntegerv(gli, GR_GL_CONTEXT_PROFILE_MASK, &profileMask); |
| 117 fIsCoreProfile = SkToBool(profileMask & GR_GL_CONTEXT_CORE_PROFILE_B
IT); |
| 118 } |
| 119 if (!fIsCoreProfile) { |
| 120 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_COORDS, &fMaxFixedFunctionT
extureCoords); |
| 121 // Sanity check |
| 122 SkASSERT(fMaxFixedFunctionTextureCoords > 0 && fMaxFixedFunctionText
ureCoords < 128); |
| 123 } |
| 112 } | 124 } |
| 113 GR_GL_GetIntegerv(gli, GR_GL_MAX_VERTEX_ATTRIBS, &fMaxVertexAttributes); | 125 GR_GL_GetIntegerv(gli, GR_GL_MAX_VERTEX_ATTRIBS, &fMaxVertexAttributes); |
| 114 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_IMAGE_UNITS, &fMaxFragmentTextureUn
its); | 126 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_IMAGE_UNITS, &fMaxFragmentTextureUn
its); |
| 115 | 127 |
| 116 if (kDesktop_GrGLBinding == binding) { | 128 if (kDesktop_GrGLBinding == binding) { |
| 117 fRGBA8RenderbufferSupport = true; | 129 fRGBA8RenderbufferSupport = true; |
| 118 } else { | 130 } else { |
| 119 fRGBA8RenderbufferSupport = ctxInfo.hasExtension("GL_OES_rgb8_rgba8") || | 131 fRGBA8RenderbufferSupport = ctxInfo.hasExtension("GL_OES_rgb8_rgba8") || |
| 120 ctxInfo.hasExtension("GL_ARM_rgba8"); | 132 ctxInfo.hasExtension("GL_ARM_rgba8"); |
| 121 } | 133 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 207 |
| 196 // SGX and Mali GPUs that are based on a tiled-deferred architecture that ha
ve trouble with | 208 // SGX and Mali GPUs that are based on a tiled-deferred architecture that ha
ve trouble with |
| 197 // frequently changing VBOs. We've measured a performance increase using non
-VBO vertex | 209 // 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 render
er string and | 210 // data for dynamic content on these GPUs. Perhaps we should read the render
er string and |
| 199 // limit this decision to specific GPU families rather than basing it on the
vendor alone. | 211 // limit this decision to specific GPU families rather than basing it on the
vendor alone. |
| 200 if (!GR_GL_MUST_USE_VBO && | 212 if (!GR_GL_MUST_USE_VBO && |
| 201 (kARM_GrGLVendor == ctxInfo.vendor() || kImagination_GrGLVendor == ctxIn
fo.vendor())) { | 213 (kARM_GrGLVendor == ctxInfo.vendor() || kImagination_GrGLVendor == ctxIn
fo.vendor())) { |
| 202 fUseNonVBOVertexAndIndexDynamicData = true; | 214 fUseNonVBOVertexAndIndexDynamicData = true; |
| 203 } | 215 } |
| 204 | 216 |
| 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 } | |
| 210 | |
| 211 fDiscardFBSupport = ctxInfo.hasExtension("GL_EXT_discard_framebuffer"); | 217 fDiscardFBSupport = ctxInfo.hasExtension("GL_EXT_discard_framebuffer"); |
| 212 | 218 |
| 213 if (kDesktop_GrGLBinding == binding) { | 219 if (kDesktop_GrGLBinding == binding) { |
| 214 fVertexArrayObjectSupport = version >= GR_GL_VER(3, 0) || | 220 fVertexArrayObjectSupport = version >= GR_GL_VER(3, 0) || |
| 215 ctxInfo.hasExtension("GL_ARB_vertex_array_ob
ject"); | 221 ctxInfo.hasExtension("GL_ARB_vertex_array_ob
ject"); |
| 216 } else { | 222 } else { |
| 217 fVertexArrayObjectSupport = version >= GR_GL_VER(3, 0) || | 223 fVertexArrayObjectSupport = version >= GR_GL_VER(3, 0) || |
| 218 ctxInfo.hasExtension("GL_OES_vertex_array_ob
ject"); | 224 ctxInfo.hasExtension("GL_OES_vertex_array_ob
ject"); |
| 219 } | 225 } |
| 220 | 226 |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 GrPrintf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); | 600 GrPrintf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); |
| 595 GrPrintf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); | 601 GrPrintf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); |
| 596 GrPrintf("Fragment coord conventions support: %s\n", | 602 GrPrintf("Fragment coord conventions support: %s\n", |
| 597 (fFragCoordsConventionSupport ? "YES": "NO")); | 603 (fFragCoordsConventionSupport ? "YES": "NO")); |
| 598 GrPrintf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "
YES": "NO")); | 604 GrPrintf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "
YES": "NO")); |
| 599 GrPrintf("Use non-VBO for dynamic data: %s\n", | 605 GrPrintf("Use non-VBO for dynamic data: %s\n", |
| 600 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); | 606 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); |
| 601 GrPrintf("Core Profile: %s\n", (fIsCoreProfile ? "YES" : "NO")); | 607 GrPrintf("Core Profile: %s\n", (fIsCoreProfile ? "YES" : "NO")); |
| 602 GrPrintf("Discard FrameBuffer support: %s\n", (fDiscardFBSupport ? "YES" : "
NO")); | 608 GrPrintf("Discard FrameBuffer support: %s\n", (fDiscardFBSupport ? "YES" : "
NO")); |
| 603 } | 609 } |
| OLD | NEW |