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 27 matching lines...) Expand all Loading... |
38 fPackFlipYSupport = false; | 38 fPackFlipYSupport = false; |
39 fTextureUsageSupport = false; | 39 fTextureUsageSupport = false; |
40 fTexStorageSupport = false; | 40 fTexStorageSupport = false; |
41 fTextureRedSupport = false; | 41 fTextureRedSupport = false; |
42 fImagingSupport = false; | 42 fImagingSupport = false; |
43 fTwoFormatLimit = false; | 43 fTwoFormatLimit = false; |
44 fFragCoordsConventionSupport = false; | 44 fFragCoordsConventionSupport = false; |
45 fVertexArrayObjectSupport = false; | 45 fVertexArrayObjectSupport = false; |
46 fUseNonVBOVertexAndIndexDynamicData = false; | 46 fUseNonVBOVertexAndIndexDynamicData = false; |
47 fIsCoreProfile = false; | 47 fIsCoreProfile = false; |
48 fFixedFunctionSupport = false; | |
49 fFullClearIsFree = false; | 48 fFullClearIsFree = false; |
50 fDropsTileOnZeroDivide = false; | 49 fDropsTileOnZeroDivide = false; |
51 fMapSubSupport = false; | 50 fMapSubSupport = false; |
52 } | 51 } |
53 | 52 |
54 GrGLCaps::GrGLCaps(const GrGLCaps& caps) : GrDrawTargetCaps() { | 53 GrGLCaps::GrGLCaps(const GrGLCaps& caps) : GrDrawTargetCaps() { |
55 *this = caps; | 54 *this = caps; |
56 } | 55 } |
57 | 56 |
58 GrGLCaps& GrGLCaps::operator= (const GrGLCaps& caps) { | 57 GrGLCaps& GrGLCaps::operator= (const GrGLCaps& caps) { |
(...skipping 18 matching lines...) Expand all Loading... |
77 fPackFlipYSupport = caps.fPackFlipYSupport; | 76 fPackFlipYSupport = caps.fPackFlipYSupport; |
78 fTextureUsageSupport = caps.fTextureUsageSupport; | 77 fTextureUsageSupport = caps.fTextureUsageSupport; |
79 fTexStorageSupport = caps.fTexStorageSupport; | 78 fTexStorageSupport = caps.fTexStorageSupport; |
80 fTextureRedSupport = caps.fTextureRedSupport; | 79 fTextureRedSupport = caps.fTextureRedSupport; |
81 fImagingSupport = caps.fImagingSupport; | 80 fImagingSupport = caps.fImagingSupport; |
82 fTwoFormatLimit = caps.fTwoFormatLimit; | 81 fTwoFormatLimit = caps.fTwoFormatLimit; |
83 fFragCoordsConventionSupport = caps.fFragCoordsConventionSupport; | 82 fFragCoordsConventionSupport = caps.fFragCoordsConventionSupport; |
84 fVertexArrayObjectSupport = caps.fVertexArrayObjectSupport; | 83 fVertexArrayObjectSupport = caps.fVertexArrayObjectSupport; |
85 fUseNonVBOVertexAndIndexDynamicData = caps.fUseNonVBOVertexAndIndexDynamicDa
ta; | 84 fUseNonVBOVertexAndIndexDynamicData = caps.fUseNonVBOVertexAndIndexDynamicDa
ta; |
86 fIsCoreProfile = caps.fIsCoreProfile; | 85 fIsCoreProfile = caps.fIsCoreProfile; |
87 fFixedFunctionSupport = caps.fFixedFunctionSupport; | |
88 fFullClearIsFree = caps.fFullClearIsFree; | 86 fFullClearIsFree = caps.fFullClearIsFree; |
89 fDropsTileOnZeroDivide = caps.fDropsTileOnZeroDivide; | 87 fDropsTileOnZeroDivide = caps.fDropsTileOnZeroDivide; |
90 fMapSubSupport = caps.fMapSubSupport; | 88 fMapSubSupport = caps.fMapSubSupport; |
91 | 89 |
92 return *this; | 90 return *this; |
93 } | 91 } |
94 | 92 |
95 void GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) { | 93 void GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) { |
96 | 94 |
97 this->reset(); | 95 this->reset(); |
(...skipping 15 matching lines...) Expand all Loading... |
113 SkASSERT(kGL_GrGLStandard == standard); | 111 SkASSERT(kGL_GrGLStandard == standard); |
114 GrGLint max; | 112 GrGLint max; |
115 GR_GL_GetIntegerv(gli, GR_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &max); | 113 GR_GL_GetIntegerv(gli, GR_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &max); |
116 fMaxFragmentUniformVectors = max / 4; | 114 fMaxFragmentUniformVectors = max / 4; |
117 if (version >= GR_GL_VER(3, 2)) { | 115 if (version >= GR_GL_VER(3, 2)) { |
118 GrGLint profileMask; | 116 GrGLint profileMask; |
119 GR_GL_GetIntegerv(gli, GR_GL_CONTEXT_PROFILE_MASK, &profileMask); | 117 GR_GL_GetIntegerv(gli, GR_GL_CONTEXT_PROFILE_MASK, &profileMask); |
120 fIsCoreProfile = SkToBool(profileMask & GR_GL_CONTEXT_CORE_PROFILE_B
IT); | 118 fIsCoreProfile = SkToBool(profileMask & GR_GL_CONTEXT_CORE_PROFILE_B
IT); |
121 } | 119 } |
122 if (!fIsCoreProfile) { | 120 if (!fIsCoreProfile) { |
123 fFixedFunctionSupport = true; | |
124 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_COORDS, &fMaxFixedFunctionT
extureCoords); | 121 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_COORDS, &fMaxFixedFunctionT
extureCoords); |
125 // Sanity check | 122 // Sanity check |
126 SkASSERT(fMaxFixedFunctionTextureCoords > 0 && fMaxFixedFunctionText
ureCoords < 128); | 123 SkASSERT(fMaxFixedFunctionTextureCoords > 0 && fMaxFixedFunctionText
ureCoords < 128); |
127 } | 124 } |
128 } | 125 } |
129 GR_GL_GetIntegerv(gli, GR_GL_MAX_VERTEX_ATTRIBS, &fMaxVertexAttributes); | 126 GR_GL_GetIntegerv(gli, GR_GL_MAX_VERTEX_ATTRIBS, &fMaxVertexAttributes); |
130 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_IMAGE_UNITS, &fMaxFragmentTextureUn
its); | 127 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_IMAGE_UNITS, &fMaxFragmentTextureUn
its); |
131 | 128 |
132 if (kGL_GrGLStandard == standard) { | 129 if (kGL_GrGLStandard == standard) { |
133 fRGBA8RenderbufferSupport = true; | 130 fRGBA8RenderbufferSupport = true; |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 | 317 |
321 fHWAALineSupport = (kGL_GrGLStandard == standard); | 318 fHWAALineSupport = (kGL_GrGLStandard == standard); |
322 | 319 |
323 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_SIZE, &fMaxTextureSize); | 320 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_SIZE, &fMaxTextureSize); |
324 GR_GL_GetIntegerv(gli, GR_GL_MAX_RENDERBUFFER_SIZE, &fMaxRenderTargetSize); | 321 GR_GL_GetIntegerv(gli, GR_GL_MAX_RENDERBUFFER_SIZE, &fMaxRenderTargetSize); |
325 // Our render targets are always created with textures as the color | 322 // Our render targets are always created with textures as the color |
326 // attachment, hence this min: | 323 // attachment, hence this min: |
327 fMaxRenderTargetSize = SkTMin(fMaxTextureSize, fMaxRenderTargetSize); | 324 fMaxRenderTargetSize = SkTMin(fMaxTextureSize, fMaxRenderTargetSize); |
328 | 325 |
329 fPathRenderingSupport = ctxInfo.hasExtension("GL_NV_path_rendering"); | 326 fPathRenderingSupport = ctxInfo.hasExtension("GL_NV_path_rendering"); |
330 SkASSERT(!fPathRenderingSupport || fFixedFunctionSupport); | |
331 | 327 |
332 fGpuTracingSupport = ctxInfo.hasExtension("GL_EXT_debug_marker"); | 328 fGpuTracingSupport = ctxInfo.hasExtension("GL_EXT_debug_marker"); |
333 | 329 |
334 fDstReadInShaderSupport = kNone_FBFetchType != fFBFetchType; | 330 fDstReadInShaderSupport = kNone_FBFetchType != fFBFetchType; |
335 | 331 |
336 // Disable scratch texture reuse on Mali and Adreno devices | 332 // Disable scratch texture reuse on Mali and Adreno devices |
337 fReuseScratchTextures = kARM_GrGLVendor != ctxInfo.vendor() && | 333 fReuseScratchTextures = kARM_GrGLVendor != ctxInfo.vendor() && |
338 kQualcomm_GrGLVendor != ctxInfo.vendor(); | 334 kQualcomm_GrGLVendor != ctxInfo.vendor(); |
339 | 335 |
340 // Enable supported shader-related caps | 336 // Enable supported shader-related caps |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 "None", | 646 "None", |
651 "Discard", | 647 "Discard", |
652 "Invalidate", | 648 "Invalidate", |
653 }; | 649 }; |
654 GR_STATIC_ASSERT(0 == kNone_InvalidateFBType); | 650 GR_STATIC_ASSERT(0 == kNone_InvalidateFBType); |
655 GR_STATIC_ASSERT(1 == kDiscard_InvalidateFBType); | 651 GR_STATIC_ASSERT(1 == kDiscard_InvalidateFBType); |
656 GR_STATIC_ASSERT(2 == kInvalidate_InvalidateFBType); | 652 GR_STATIC_ASSERT(2 == kInvalidate_InvalidateFBType); |
657 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kInvalidateFBTypeStr) == kLast_InvalidateFBT
ype + 1); | 653 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kInvalidateFBTypeStr) == kLast_InvalidateFBT
ype + 1); |
658 | 654 |
659 r.appendf("Core Profile: %s\n", (fIsCoreProfile ? "YES" : "NO")); | 655 r.appendf("Core Profile: %s\n", (fIsCoreProfile ? "YES" : "NO")); |
660 r.appendf("Fixed Function Support: %s\n", (fFixedFunctionSupport ? "YES" : "
NO")); | |
661 r.appendf("MSAA Type: %s\n", kMSFBOExtStr[fMSFBOType]); | 656 r.appendf("MSAA Type: %s\n", kMSFBOExtStr[fMSFBOType]); |
662 r.appendf("FB Fetch Type: %s\n", kFBFetchTypeStr[fFBFetchType]); | 657 r.appendf("FB Fetch Type: %s\n", kFBFetchTypeStr[fFBFetchType]); |
663 r.appendf("Invalidate FB Type: %s\n", kInvalidateFBTypeStr[fInvalidateFBType
]); | 658 r.appendf("Invalidate FB Type: %s\n", kInvalidateFBTypeStr[fInvalidateFBType
]); |
664 r.appendf("Max FS Uniform Vectors: %d\n", fMaxFragmentUniformVectors); | 659 r.appendf("Max FS Uniform Vectors: %d\n", fMaxFragmentUniformVectors); |
665 r.appendf("Max FS Texture Units: %d\n", fMaxFragmentTextureUnits); | 660 r.appendf("Max FS Texture Units: %d\n", fMaxFragmentTextureUnits); |
666 if (fFixedFunctionSupport) { | 661 if (!fIsCoreProfile) { |
667 r.appendf("Max Fixed Function Texture Coords: %d\n", fMaxFixedFunctionTe
xtureCoords); | 662 r.appendf("Max Fixed Function Texture Coords: %d\n", fMaxFixedFunctionTe
xtureCoords); |
668 } | 663 } |
669 r.appendf("Max Vertex Attributes: %d\n", fMaxVertexAttributes); | 664 r.appendf("Max Vertex Attributes: %d\n", fMaxVertexAttributes); |
670 r.appendf("Support RGBA8 Render Buffer: %s\n", (fRGBA8RenderbufferSupport ?
"YES": "NO")); | 665 r.appendf("Support RGBA8 Render Buffer: %s\n", (fRGBA8RenderbufferSupport ?
"YES": "NO")); |
671 r.appendf("BGRA support: %s\n", (fBGRAFormatSupport ? "YES": "NO")); | 666 r.appendf("BGRA support: %s\n", (fBGRAFormatSupport ? "YES": "NO")); |
672 r.appendf("BGRA is an internal format: %s\n", (fBGRAIsInternalFormat ? "YES"
: "NO")); | 667 r.appendf("BGRA is an internal format: %s\n", (fBGRAIsInternalFormat ? "YES"
: "NO")); |
673 r.appendf("Support texture swizzle: %s\n", (fTextureSwizzleSupport ? "YES":
"NO")); | 668 r.appendf("Support texture swizzle: %s\n", (fTextureSwizzleSupport ? "YES":
"NO")); |
674 r.appendf("Unpack Row length support: %s\n", (fUnpackRowLengthSupport ? "YES
": "NO")); | 669 r.appendf("Unpack Row length support: %s\n", (fUnpackRowLengthSupport ? "YES
": "NO")); |
675 r.appendf("Unpack Flip Y support: %s\n", (fUnpackFlipYSupport ? "YES": "NO")
); | 670 r.appendf("Unpack Flip Y support: %s\n", (fUnpackFlipYSupport ? "YES": "NO")
); |
676 r.appendf("Pack Row length support: %s\n", (fPackRowLengthSupport ? "YES": "
NO")); | 671 r.appendf("Pack Row length support: %s\n", (fPackRowLengthSupport ? "YES": "
NO")); |
677 r.appendf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO")); | 672 r.appendf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO")); |
678 | 673 |
679 r.appendf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO"
)); | 674 r.appendf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO"
)); |
680 r.appendf("Texture Storage support: %s\n", (fTexStorageSupport ? "YES": "NO"
)); | 675 r.appendf("Texture Storage support: %s\n", (fTexStorageSupport ? "YES": "NO"
)); |
681 r.appendf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); | 676 r.appendf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); |
682 r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); | 677 r.appendf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); |
683 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); | 678 r.appendf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); |
684 r.appendf("Fragment coord conventions support: %s\n", | 679 r.appendf("Fragment coord conventions support: %s\n", |
685 (fFragCoordsConventionSupport ? "YES": "NO")); | 680 (fFragCoordsConventionSupport ? "YES": "NO")); |
686 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ?
"YES": "NO")); | 681 r.appendf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ?
"YES": "NO")); |
687 r.appendf("Use non-VBO for dynamic data: %s\n", | 682 r.appendf("Use non-VBO for dynamic data: %s\n", |
688 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); | 683 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); |
689 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO
")); | 684 r.appendf("Full screen clear is free: %s\n", (fFullClearIsFree ? "YES" : "NO
")); |
690 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES"
: "NO")); | 685 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES"
: "NO")); |
691 return r; | 686 return r; |
692 } | 687 } |
OLD | NEW |