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 29 matching lines...) Expand all Loading... |
40 fPackFlipYSupport = false; | 40 fPackFlipYSupport = false; |
41 fTextureUsageSupport = false; | 41 fTextureUsageSupport = false; |
42 fTexStorageSupport = false; | 42 fTexStorageSupport = false; |
43 fTextureRedSupport = false; | 43 fTextureRedSupport = false; |
44 fImagingSupport = false; | 44 fImagingSupport = false; |
45 fTwoFormatLimit = false; | 45 fTwoFormatLimit = false; |
46 fFragCoordsConventionSupport = false; | 46 fFragCoordsConventionSupport = false; |
47 fVertexArrayObjectSupport = false; | 47 fVertexArrayObjectSupport = false; |
48 fUseNonVBOVertexAndIndexDynamicData = false; | 48 fUseNonVBOVertexAndIndexDynamicData = false; |
49 fIsCoreProfile = false; | 49 fIsCoreProfile = false; |
| 50 fFixedFunctionSupport = false; |
50 fDiscardFBSupport = false; | 51 fDiscardFBSupport = false; |
51 } | 52 } |
52 | 53 |
53 GrGLCaps::GrGLCaps(const GrGLCaps& caps) : GrDrawTargetCaps() { | 54 GrGLCaps::GrGLCaps(const GrGLCaps& caps) : GrDrawTargetCaps() { |
54 *this = caps; | 55 *this = caps; |
55 } | 56 } |
56 | 57 |
57 GrGLCaps& GrGLCaps::operator = (const GrGLCaps& caps) { | 58 GrGLCaps& GrGLCaps::operator = (const GrGLCaps& caps) { |
58 INHERITED::operator=(caps); | 59 INHERITED::operator=(caps); |
59 fVerifiedColorConfigs = caps.fVerifiedColorConfigs; | 60 fVerifiedColorConfigs = caps.fVerifiedColorConfigs; |
(...skipping 17 matching lines...) Expand all Loading... |
77 fPackFlipYSupport = caps.fPackFlipYSupport; | 78 fPackFlipYSupport = caps.fPackFlipYSupport; |
78 fTextureUsageSupport = caps.fTextureUsageSupport; | 79 fTextureUsageSupport = caps.fTextureUsageSupport; |
79 fTexStorageSupport = caps.fTexStorageSupport; | 80 fTexStorageSupport = caps.fTexStorageSupport; |
80 fTextureRedSupport = caps.fTextureRedSupport; | 81 fTextureRedSupport = caps.fTextureRedSupport; |
81 fImagingSupport = caps.fImagingSupport; | 82 fImagingSupport = caps.fImagingSupport; |
82 fTwoFormatLimit = caps.fTwoFormatLimit; | 83 fTwoFormatLimit = caps.fTwoFormatLimit; |
83 fFragCoordsConventionSupport = caps.fFragCoordsConventionSupport; | 84 fFragCoordsConventionSupport = caps.fFragCoordsConventionSupport; |
84 fVertexArrayObjectSupport = caps.fVertexArrayObjectSupport; | 85 fVertexArrayObjectSupport = caps.fVertexArrayObjectSupport; |
85 fUseNonVBOVertexAndIndexDynamicData = caps.fUseNonVBOVertexAndIndexDynamicDa
ta; | 86 fUseNonVBOVertexAndIndexDynamicData = caps.fUseNonVBOVertexAndIndexDynamicDa
ta; |
86 fIsCoreProfile = caps.fIsCoreProfile; | 87 fIsCoreProfile = caps.fIsCoreProfile; |
| 88 fFixedFunctionSupport = caps.fFixedFunctionSupport; |
87 fDiscardFBSupport = caps.fDiscardFBSupport; | 89 fDiscardFBSupport = caps.fDiscardFBSupport; |
88 | 90 |
89 return *this; | 91 return *this; |
90 } | 92 } |
91 | 93 |
92 void GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) { | 94 void GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) { |
93 | 95 |
94 this->reset(); | 96 this->reset(); |
95 if (!ctxInfo.isInitialized()) { | 97 if (!ctxInfo.isInitialized()) { |
96 return; | 98 return; |
(...skipping 13 matching lines...) Expand all Loading... |
110 SkASSERT(kDesktop_GrGLBinding == binding); | 112 SkASSERT(kDesktop_GrGLBinding == binding); |
111 GrGLint max; | 113 GrGLint max; |
112 GR_GL_GetIntegerv(gli, GR_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &max); | 114 GR_GL_GetIntegerv(gli, GR_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &max); |
113 fMaxFragmentUniformVectors = max / 4; | 115 fMaxFragmentUniformVectors = max / 4; |
114 if (version >= GR_GL_VER(3, 2)) { | 116 if (version >= GR_GL_VER(3, 2)) { |
115 GrGLint profileMask; | 117 GrGLint profileMask; |
116 GR_GL_GetIntegerv(gli, GR_GL_CONTEXT_PROFILE_MASK, &profileMask); | 118 GR_GL_GetIntegerv(gli, GR_GL_CONTEXT_PROFILE_MASK, &profileMask); |
117 fIsCoreProfile = SkToBool(profileMask & GR_GL_CONTEXT_CORE_PROFILE_B
IT); | 119 fIsCoreProfile = SkToBool(profileMask & GR_GL_CONTEXT_CORE_PROFILE_B
IT); |
118 } | 120 } |
119 if (!fIsCoreProfile) { | 121 if (!fIsCoreProfile) { |
| 122 fFixedFunctionSupport = true; |
120 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_COORDS, &fMaxFixedFunctionT
extureCoords); | 123 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_COORDS, &fMaxFixedFunctionT
extureCoords); |
121 // Sanity check | 124 // Sanity check |
122 SkASSERT(fMaxFixedFunctionTextureCoords > 0 && fMaxFixedFunctionText
ureCoords < 128); | 125 SkASSERT(fMaxFixedFunctionTextureCoords > 0 && fMaxFixedFunctionText
ureCoords < 128); |
123 } | 126 } |
124 } | 127 } |
125 GR_GL_GetIntegerv(gli, GR_GL_MAX_VERTEX_ATTRIBS, &fMaxVertexAttributes); | 128 GR_GL_GetIntegerv(gli, GR_GL_MAX_VERTEX_ATTRIBS, &fMaxVertexAttributes); |
126 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_IMAGE_UNITS, &fMaxFragmentTextureUn
its); | 129 GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_IMAGE_UNITS, &fMaxFragmentTextureUn
its); |
127 | 130 |
128 if (kDesktop_GrGLBinding == binding) { | 131 if (kDesktop_GrGLBinding == binding) { |
129 fRGBA8RenderbufferSupport = true; | 132 fRGBA8RenderbufferSupport = true; |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 "None", | 585 "None", |
583 "EXT", | 586 "EXT", |
584 "NV", | 587 "NV", |
585 }; | 588 }; |
586 GR_STATIC_ASSERT(0 == kNone_FBFetchType); | 589 GR_STATIC_ASSERT(0 == kNone_FBFetchType); |
587 GR_STATIC_ASSERT(1 == kEXT_FBFetchType); | 590 GR_STATIC_ASSERT(1 == kEXT_FBFetchType); |
588 GR_STATIC_ASSERT(2 == kNV_FBFetchType); | 591 GR_STATIC_ASSERT(2 == kNV_FBFetchType); |
589 GR_STATIC_ASSERT(GR_ARRAY_COUNT(kFBFetchTypeStr) == kLast_FBFetchType + 1); | 592 GR_STATIC_ASSERT(GR_ARRAY_COUNT(kFBFetchTypeStr) == kLast_FBFetchType + 1); |
590 | 593 |
591 | 594 |
| 595 GrPrintf("Core Profile: %s\n", (fIsCoreProfile ? "YES" : "NO")); |
| 596 GrPrintf("Fixed Function Support: %s\n", (fFixedFunctionSupport ? "YES" : "N
O")); |
592 GrPrintf("MSAA Type: %s\n", kMSFBOExtStr[fMSFBOType]); | 597 GrPrintf("MSAA Type: %s\n", kMSFBOExtStr[fMSFBOType]); |
593 GrPrintf("FB Fetch Type: %s\n", kFBFetchTypeStr[fFBFetchType]); | 598 GrPrintf("FB Fetch Type: %s\n", kFBFetchTypeStr[fFBFetchType]); |
594 GrPrintf("Max FS Uniform Vectors: %d\n", fMaxFragmentUniformVectors); | 599 GrPrintf("Max FS Uniform Vectors: %d\n", fMaxFragmentUniformVectors); |
| 600 GrPrintf("Max FS Texture Units: %d\n", fMaxFragmentTextureUnits); |
| 601 if (fFixedFunctionSupport) { |
| 602 GrPrintf("Max Fixed Function Texture Coords: %d\n", fMaxFixedFunctionTex
tureCoords); |
| 603 } |
595 GrPrintf("Max Vertex Attributes: %d\n", fMaxVertexAttributes); | 604 GrPrintf("Max Vertex Attributes: %d\n", fMaxVertexAttributes); |
596 GrPrintf("Support RGBA8 Render Buffer: %s\n", (fRGBA8RenderbufferSupport ? "
YES": "NO")); | 605 GrPrintf("Support RGBA8 Render Buffer: %s\n", (fRGBA8RenderbufferSupport ? "
YES": "NO")); |
597 GrPrintf("BGRA support: %s\n", (fBGRAFormatSupport ? "YES": "NO")); | 606 GrPrintf("BGRA support: %s\n", (fBGRAFormatSupport ? "YES": "NO")); |
598 GrPrintf("BGRA is an internal format: %s\n", (fBGRAIsInternalFormat ? "YES":
"NO")); | 607 GrPrintf("BGRA is an internal format: %s\n", (fBGRAIsInternalFormat ? "YES":
"NO")); |
599 GrPrintf("Support texture swizzle: %s\n", (fTextureSwizzleSupport ? "YES": "
NO")); | 608 GrPrintf("Support texture swizzle: %s\n", (fTextureSwizzleSupport ? "YES": "
NO")); |
600 GrPrintf("Unpack Row length support: %s\n", (fUnpackRowLengthSupport ? "YES"
: "NO")); | 609 GrPrintf("Unpack Row length support: %s\n", (fUnpackRowLengthSupport ? "YES"
: "NO")); |
601 GrPrintf("Unpack Flip Y support: %s\n", (fUnpackFlipYSupport ? "YES": "NO"))
; | 610 GrPrintf("Unpack Flip Y support: %s\n", (fUnpackFlipYSupport ? "YES": "NO"))
; |
602 GrPrintf("Pack Row length support: %s\n", (fPackRowLengthSupport ? "YES": "N
O")); | 611 GrPrintf("Pack Row length support: %s\n", (fPackRowLengthSupport ? "YES": "N
O")); |
603 GrPrintf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO")); | 612 GrPrintf("Pack Flip Y support: %s\n", (fPackFlipYSupport ? "YES": "NO")); |
604 | 613 |
605 GrPrintf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO")
); | 614 GrPrintf("Texture Usage support: %s\n", (fTextureUsageSupport ? "YES": "NO")
); |
606 GrPrintf("Texture Storage support: %s\n", (fTexStorageSupport ? "YES": "NO")
); | 615 GrPrintf("Texture Storage support: %s\n", (fTexStorageSupport ? "YES": "NO")
); |
607 GrPrintf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); | 616 GrPrintf("GL_R support: %s\n", (fTextureRedSupport ? "YES": "NO")); |
608 GrPrintf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); | 617 GrPrintf("GL_ARB_imaging support: %s\n", (fImagingSupport ? "YES": "NO")); |
609 GrPrintf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); | 618 GrPrintf("Two Format Limit: %s\n", (fTwoFormatLimit ? "YES": "NO")); |
610 GrPrintf("Fragment coord conventions support: %s\n", | 619 GrPrintf("Fragment coord conventions support: %s\n", |
611 (fFragCoordsConventionSupport ? "YES": "NO")); | 620 (fFragCoordsConventionSupport ? "YES": "NO")); |
612 GrPrintf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "
YES": "NO")); | 621 GrPrintf("Vertex array object support: %s\n", (fVertexArrayObjectSupport ? "
YES": "NO")); |
613 GrPrintf("Use non-VBO for dynamic data: %s\n", | 622 GrPrintf("Use non-VBO for dynamic data: %s\n", |
614 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); | 623 (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO")); |
615 GrPrintf("Core Profile: %s\n", (fIsCoreProfile ? "YES" : "NO")); | |
616 GrPrintf("Discard FrameBuffer support: %s\n", (fDiscardFBSupport ? "YES" : "
NO")); | 624 GrPrintf("Discard FrameBuffer support: %s\n", (fDiscardFBSupport ? "YES" : "
NO")); |
617 } | 625 } |
OLD | NEW |