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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 } else { | 110 } else { |
111 SkASSERT(kGL_GrGLStandard == standard); | 111 SkASSERT(kGL_GrGLStandard == standard); |
112 GrGLint max; | 112 GrGLint max; |
113 GR_GL_GetIntegerv(gli, GR_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &max); | 113 GR_GL_GetIntegerv(gli, GR_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &max); |
114 fMaxFragmentUniformVectors = max / 4; | 114 fMaxFragmentUniformVectors = max / 4; |
115 if (version >= GR_GL_VER(3, 2)) { | 115 if (version >= GR_GL_VER(3, 2)) { |
116 GrGLint profileMask; | 116 GrGLint profileMask; |
117 GR_GL_GetIntegerv(gli, GR_GL_CONTEXT_PROFILE_MASK, &profileMask); | 117 GR_GL_GetIntegerv(gli, GR_GL_CONTEXT_PROFILE_MASK, &profileMask); |
118 fIsCoreProfile = SkToBool(profileMask & GR_GL_CONTEXT_CORE_PROFILE_B
IT); | 118 fIsCoreProfile = SkToBool(profileMask & GR_GL_CONTEXT_CORE_PROFILE_B
IT); |
119 } | 119 } |
120 if (!fIsCoreProfile) { | |
121 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_COORDS, &fMaxFixedFunctionT
extureCoords); | |
122 // Sanity check | |
123 SkASSERT(fMaxFixedFunctionTextureCoords > 0 && fMaxFixedFunctionText
ureCoords < 128); | |
124 } | |
125 } | 120 } |
| 121 |
| 122 |
126 GR_GL_GetIntegerv(gli, GR_GL_MAX_VERTEX_ATTRIBS, &fMaxVertexAttributes); | 123 GR_GL_GetIntegerv(gli, GR_GL_MAX_VERTEX_ATTRIBS, &fMaxVertexAttributes); |
127 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_IMAGE_UNITS, &fMaxFragmentTextureUn
its); | 124 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_IMAGE_UNITS, &fMaxFragmentTextureUn
its); |
128 | 125 |
129 if (kGL_GrGLStandard == standard) { | 126 if (kGL_GrGLStandard == standard) { |
130 fRGBA8RenderbufferSupport = true; | 127 fRGBA8RenderbufferSupport = true; |
131 } else { | 128 } else { |
132 fRGBA8RenderbufferSupport = version >= GR_GL_VER(3,0) || | 129 fRGBA8RenderbufferSupport = version >= GR_GL_VER(3,0) || |
133 ctxInfo.hasExtension("GL_OES_rgb8_rgba8") || | 130 ctxInfo.hasExtension("GL_OES_rgb8_rgba8") || |
134 ctxInfo.hasExtension("GL_ARM_rgba8"); | 131 ctxInfo.hasExtension("GL_ARM_rgba8"); |
135 } | 132 } |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 } | 313 } |
317 | 314 |
318 fHWAALineSupport = (kGL_GrGLStandard == standard); | 315 fHWAALineSupport = (kGL_GrGLStandard == standard); |
319 | 316 |
320 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_SIZE, &fMaxTextureSize); | 317 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_SIZE, &fMaxTextureSize); |
321 GR_GL_GetIntegerv(gli, GR_GL_MAX_RENDERBUFFER_SIZE, &fMaxRenderTargetSize); | 318 GR_GL_GetIntegerv(gli, GR_GL_MAX_RENDERBUFFER_SIZE, &fMaxRenderTargetSize); |
322 // Our render targets are always created with textures as the color | 319 // Our render targets are always created with textures as the color |
323 // attachment, hence this min: | 320 // attachment, hence this min: |
324 fMaxRenderTargetSize = SkTMin(fMaxTextureSize, fMaxRenderTargetSize); | 321 fMaxRenderTargetSize = SkTMin(fMaxTextureSize, fMaxRenderTargetSize); |
325 | 322 |
326 fPathRenderingSupport = ctxInfo.hasExtension("GL_NV_path_rendering") && | 323 fPathRenderingSupport = (ctxInfo.hasExtension("GL_NV_path_rendering") && |
327 ctxInfo.hasExtension("GL_EXT_direct_state_access"); | 324 ctxInfo.hasExtension("GL_EXT_direct_state_access")) |
| 325 || ctxInfo.hasExtension("GL_CHROMIUM_path_rendering"); |
| 326 |
| 327 if (fPathRenderingSupport) { |
| 328 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_COORDS, &fMaxFixedFunctionTextu
reCoords); |
| 329 // Sanity check |
| 330 SkASSERT(fMaxFixedFunctionTextureCoords > 0 && fMaxFixedFunctionTextureC
oords < 128); |
| 331 } |
328 | 332 |
329 fGpuTracingSupport = ctxInfo.hasExtension("GL_EXT_debug_marker"); | 333 fGpuTracingSupport = ctxInfo.hasExtension("GL_EXT_debug_marker"); |
330 | 334 |
331 fDstReadInShaderSupport = kNone_FBFetchType != fFBFetchType; | 335 fDstReadInShaderSupport = kNone_FBFetchType != fFBFetchType; |
332 | 336 |
333 // Disable scratch texture reuse on Mali and Adreno devices | 337 // Disable scratch texture reuse on Mali and Adreno devices |
334 fReuseScratchTextures = kARM_GrGLVendor != ctxInfo.vendor() && | 338 fReuseScratchTextures = kARM_GrGLVendor != ctxInfo.vendor() && |
335 kQualcomm_GrGLVendor != ctxInfo.vendor(); | 339 kQualcomm_GrGLVendor != ctxInfo.vendor(); |
336 | 340 |
337 // Enable supported shader-related caps | 341 // Enable supported shader-related caps |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 GR_STATIC_ASSERT(1 == kDiscard_InvalidateFBType); | 656 GR_STATIC_ASSERT(1 == kDiscard_InvalidateFBType); |
653 GR_STATIC_ASSERT(2 == kInvalidate_InvalidateFBType); | 657 GR_STATIC_ASSERT(2 == kInvalidate_InvalidateFBType); |
654 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kInvalidateFBTypeStr) == kLast_InvalidateFBT
ype + 1); | 658 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kInvalidateFBTypeStr) == kLast_InvalidateFBT
ype + 1); |
655 | 659 |
656 r.appendf("Core Profile: %s\n", (fIsCoreProfile ? "YES" : "NO")); | 660 r.appendf("Core Profile: %s\n", (fIsCoreProfile ? "YES" : "NO")); |
657 r.appendf("MSAA Type: %s\n", kMSFBOExtStr[fMSFBOType]); | 661 r.appendf("MSAA Type: %s\n", kMSFBOExtStr[fMSFBOType]); |
658 r.appendf("FB Fetch Type: %s\n", kFBFetchTypeStr[fFBFetchType]); | 662 r.appendf("FB Fetch Type: %s\n", kFBFetchTypeStr[fFBFetchType]); |
659 r.appendf("Invalidate FB Type: %s\n", kInvalidateFBTypeStr[fInvalidateFBType
]); | 663 r.appendf("Invalidate FB Type: %s\n", kInvalidateFBTypeStr[fInvalidateFBType
]); |
660 r.appendf("Max FS Uniform Vectors: %d\n", fMaxFragmentUniformVectors); | 664 r.appendf("Max FS Uniform Vectors: %d\n", fMaxFragmentUniformVectors); |
661 r.appendf("Max FS Texture Units: %d\n", fMaxFragmentTextureUnits); | 665 r.appendf("Max FS Texture Units: %d\n", fMaxFragmentTextureUnits); |
662 if (!fIsCoreProfile) { | 666 if (this->pathRenderingSupport()) { |
663 r.appendf("Max Fixed Function Texture Coords: %d\n", fMaxFixedFunctionTe
xtureCoords); | 667 r.appendf("Max Fixed Function Texture Coords: %d\n", fMaxFixedFunctionTe
xtureCoords); |
664 } | 668 } |
665 r.appendf("Max Vertex Attributes: %d\n", fMaxVertexAttributes); | 669 r.appendf("Max Vertex Attributes: %d\n", fMaxVertexAttributes); |
666 r.appendf("Support RGBA8 Render Buffer: %s\n", (fRGBA8RenderbufferSupport ?
"YES": "NO")); | 670 r.appendf("Support RGBA8 Render Buffer: %s\n", (fRGBA8RenderbufferSupport ?
"YES": "NO")); |
667 r.appendf("BGRA support: %s\n", (fBGRAFormatSupport ? "YES": "NO")); | 671 r.appendf("BGRA support: %s\n", (fBGRAFormatSupport ? "YES": "NO")); |
668 r.appendf("BGRA is an internal format: %s\n", (fBGRAIsInternalFormat ? "YES"
: "NO")); | 672 r.appendf("BGRA is an internal format: %s\n", (fBGRAIsInternalFormat ? "YES"
: "NO")); |
669 r.appendf("Support texture swizzle: %s\n", (fTextureSwizzleSupport ? "YES":
"NO")); | 673 r.appendf("Support texture swizzle: %s\n", (fTextureSwizzleSupport ? "YES":
"NO")); |
670 r.appendf("Unpack Row length support: %s\n", (fUnpackRowLengthSupport ? "YES
": "NO")); | 674 r.appendf("Unpack Row length support: %s\n", (fUnpackRowLengthSupport ? "YES
": "NO")); |
671 r.appendf("Unpack Flip Y support: %s\n", (fUnpackFlipYSupport ? "YES": "NO")
); | 675 r.appendf("Unpack Flip Y support: %s\n", (fUnpackFlipYSupport ? "YES": "NO")
); |
672 r.appendf("Pack Row length support: %s\n", (fPackRowLengthSupport ? "YES": "
NO")); | 676 r.appendf("Pack Row length support: %s\n", (fPackRowLengthSupport ? "YES": "
NO")); |
673 r.appendf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO")); | 677 r.appendf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO")); |
674 | 678 |
675 r.appendf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO"
)); | 679 r.appendf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO"
)); |
676 r.appendf("Texture Storage support: %s\n", (fTexStorageSupport ? "YES": "NO"
)); | 680 r.appendf("Texture Storage support: %s\n", (fTexStorageSupport ? "YES": "NO"
)); |
677 r.appendf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); | 681 r.appendf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); |
678 r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); | 682 r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); |
679 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); | 683 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); |
680 r.appendf("Fragment coord conventions support: %s\n", | 684 r.appendf("Fragment coord conventions support: %s\n", |
681 (fFragCoordsConventionSupport ? "YES": "NO")); | 685 (fFragCoordsConventionSupport ? "YES": "NO")); |
682 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ?
"YES": "NO")); | 686 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ?
"YES": "NO")); |
683 r.appendf("Use non-VBO for dynamic data: %s\n", | 687 r.appendf("Use non-VBO for dynamic data: %s\n", |
684 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); | 688 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); |
685 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO
")); | 689 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO
")); |
686 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES"
: "NO")); | 690 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES"
: "NO")); |
687 return r; | 691 return r; |
688 } | 692 } |
OLD | NEW |