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 "GrGLSLCaps.h" | 9 #include "GrGLSLCaps.h" |
10 | 10 |
11 #include "GrContextOptions.h" | 11 #include "GrContextOptions.h" |
12 | 12 |
13 ////////////////////////////////////////////////////////////////////////////////
//////////// | 13 ////////////////////////////////////////////////////////////////////////////////
//////////// |
14 | 14 |
15 GrGLSLCaps::GrGLSLCaps(const GrContextOptions& options) { | 15 GrGLSLCaps::GrGLSLCaps(const GrContextOptions& options) { |
16 fGLSLGeneration = k330_GrGLSLGeneration; | 16 fGLSLGeneration = k330_GrGLSLGeneration; |
17 | 17 |
18 fDropsTileOnZeroDivide = false; | 18 fDropsTileOnZeroDivide = false; |
19 fFBFetchSupport = false; | 19 fFBFetchSupport = false; |
20 fFBFetchNeedsCustomOutput = false; | 20 fFBFetchNeedsCustomOutput = false; |
21 fBindlessTextureSupport = false; | 21 fBindlessTextureSupport = false; |
22 fUsesPrecisionModifiers = false; | 22 fUsesPrecisionModifiers = false; |
23 fCanUseAnyFunctionInShader = true; | 23 fCanUseAnyFunctionInShader = true; |
24 fForceHighPrecisionNDSTransform = false; | 24 fForceHighPrecisionNDSTransform = false; |
| 25 fCanUseMinAndAbsTogether = true; |
| 26 fMustForceNegatedAtanParamToFloat = false; |
25 fVersionDeclString = nullptr; | 27 fVersionDeclString = nullptr; |
26 fShaderDerivativeExtensionString = nullptr; | 28 fShaderDerivativeExtensionString = nullptr; |
| 29 fFragCoordConventionsExtensionString = nullptr; |
| 30 fSecondaryOutputExtensionString = nullptr; |
27 fFBFetchColorName = nullptr; | 31 fFBFetchColorName = nullptr; |
28 fFBFetchExtensionString = nullptr; | 32 fFBFetchExtensionString = nullptr; |
29 fAdvBlendEqInteraction = kNotSupported_AdvBlendEqInteraction; | 33 fAdvBlendEqInteraction = kNotSupported_AdvBlendEqInteraction; |
30 | 34 |
31 fMustSwizzleInShader = false; | 35 fMustSwizzleInShader = false; |
32 memset(fConfigSwizzle, 0, sizeof(fConfigSwizzle)); | 36 memset(fConfigSwizzle, 0, sizeof(fConfigSwizzle)); |
33 } | 37 } |
34 | 38 |
35 SkString GrGLSLCaps::dump() const { | 39 SkString GrGLSLCaps::dump() const { |
36 SkString r = INHERITED::dump(); | 40 SkString r = INHERITED::dump(); |
37 | 41 |
38 static const char* kAdvBlendEqInteractionStr[] = { | 42 static const char* kAdvBlendEqInteractionStr[] = { |
39 "Not Supported", | 43 "Not Supported", |
40 "Automatic", | 44 "Automatic", |
41 "General Enable", | 45 "General Enable", |
42 "Specific Enables", | 46 "Specific Enables", |
43 }; | 47 }; |
44 GR_STATIC_ASSERT(0 == kNotSupported_AdvBlendEqInteraction); | 48 GR_STATIC_ASSERT(0 == kNotSupported_AdvBlendEqInteraction); |
45 GR_STATIC_ASSERT(1 == kAutomatic_AdvBlendEqInteraction); | 49 GR_STATIC_ASSERT(1 == kAutomatic_AdvBlendEqInteraction); |
46 GR_STATIC_ASSERT(2 == kGeneralEnable_AdvBlendEqInteraction); | 50 GR_STATIC_ASSERT(2 == kGeneralEnable_AdvBlendEqInteraction); |
47 GR_STATIC_ASSERT(3 == kSpecificEnables_AdvBlendEqInteraction); | 51 GR_STATIC_ASSERT(3 == kSpecificEnables_AdvBlendEqInteraction); |
48 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kAdvBlendEqInteractionStr) == kLast_AdvBlend
EqInteraction + 1); | 52 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kAdvBlendEqInteractionStr) == kLast_AdvBlend
EqInteraction + 1); |
49 | 53 |
50 r.appendf("--- GLSL-Specific ---\n"); | 54 r.appendf("--- GLSL-Specific ---\n"); |
51 | 55 |
52 r.appendf("FB Fetch Support: %s\n", (fFBFetchSupport ? "YES" : "NO")); | 56 r.appendf("FB Fetch Support: %s\n", (fFBFetchSupport ? "YES" : "NO")); |
53 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES"
: "NO")); | 57 r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES"
: "NO")); |
54 r.appendf("Bindless texture support: %s\n", (fBindlessTextureSupport ? "YES"
: "NO")); | 58 r.appendf("Bindless texture support: %s\n", (fBindlessTextureSupport ? "YES"
: "NO")); |
55 r.appendf("Uses precision modifiers: %s\n", (fUsesPrecisionModifiers ? "YES"
: "NO")); | 59 r.appendf("Uses precision modifiers: %s\n", (fUsesPrecisionModifiers ? "YES"
: "NO")); |
56 r.appendf("Can Use any() function: %s\n", (fCanUseAnyFunctionInShader ? "YES
" : "NO")); | 60 r.appendf("Can use any() function: %s\n", (fCanUseAnyFunctionInShader ? "YES
" : "NO")); |
57 r.appendf("Force high precision on NDS transform: %s\n", (fForceHighPrecisio
nNDSTransform ? | 61 r.appendf("Force high precision on NDS transform: %s\n", (fForceHighPrecisio
nNDSTransform ? |
58 "YES" : "NO")); | 62 "YES" : "NO")); |
| 63 r.appendf("Can use min() and abs() together: %s\n", (fCanUseMinAndAbsTogethe
r ? "YES" : "NO")); |
| 64 r.appendf("Must force negated atan param to float: %s\n", (fMustForceNegated
AtanParamToFloat ? |
| 65 "YES" : "NO")); |
59 r.appendf("Advanced blend equation interaction: %s\n", | 66 r.appendf("Advanced blend equation interaction: %s\n", |
60 kAdvBlendEqInteractionStr[fAdvBlendEqInteraction]); | 67 kAdvBlendEqInteractionStr[fAdvBlendEqInteraction]); |
61 return r; | 68 return r; |
62 } | 69 } |
63 | 70 |
64 void GrGLSLCaps::onApplyOptionsOverrides(const GrContextOptions& options) { | 71 void GrGLSLCaps::onApplyOptionsOverrides(const GrContextOptions& options) { |
65 if (options.fUseShaderSwizzling) { | 72 if (options.fUseShaderSwizzling) { |
66 fMustSwizzleInShader = true; | 73 fMustSwizzleInShader = true; |
67 } | 74 } |
68 } | 75 } |
69 | 76 |
OLD | NEW |