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 #ifndef GrGLSLCaps_DEFINED | 9 #ifndef GrGLSLCaps_DEFINED |
10 #define GrGLSLCaps_DEFINED | 10 #define GrGLSLCaps_DEFINED |
11 | 11 |
12 #include "GrCaps.h" | 12 #include "GrCaps.h" |
13 #include "GrGLSL.h" | 13 #include "GrGLSL.h" |
14 #include "GrSwizzle.h" | |
15 | 14 |
16 class GrGLSLCaps : public GrShaderCaps { | 15 class GrGLSLCaps : public GrShaderCaps { |
17 public: | 16 public: |
18 | 17 |
19 | 18 |
20 /** | 19 /** |
21 * Indicates how GLSL must interact with advanced blend equations. The KHR ex
tension requires | 20 * Indicates how GLSL must interact with advanced blend equations. The KHR ex
tension requires |
22 * special layout qualifiers in the fragment shader. | 21 * special layout qualifiers in the fragment shader. |
23 */ | 22 */ |
24 enum AdvBlendEqInteraction { | 23 enum AdvBlendEqInteraction { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // extension is required. However, the return value of this function does no
t say whether dual | 97 // extension is required. However, the return value of this function does no
t say whether dual |
99 // source blending is supported. | 98 // source blending is supported. |
100 const char* secondaryOutputExtensionString() const { | 99 const char* secondaryOutputExtensionString() const { |
101 return fSecondaryOutputExtensionString; | 100 return fSecondaryOutputExtensionString; |
102 } | 101 } |
103 | 102 |
104 const char* externalTextureExtensionString() const { | 103 const char* externalTextureExtensionString() const { |
105 return fExternalTextureExtensionString; | 104 return fExternalTextureExtensionString; |
106 } | 105 } |
107 | 106 |
| 107 bool mustSwizzleInShader() const { return fMustSwizzleInShader; } |
| 108 |
108 /** | 109 /** |
109 * Given a texture's config, this determines what swizzle must be appended t
o accesses to the | 110 * Returns a string which represents how to map from an internal GLFormat to
a given |
110 * texture in generated shader code. Swizzling may be implemented in texture
parameters or a | 111 * GrPixelConfig. The function mustSwizzleInShader determines whether this s
wizzle is applied |
111 * sampler rather than in the shader. In this case the shader swizzle will a
lways be "rgba". | 112 * in the generated shader code or using sample state in the 3D API. |
112 */ | 113 */ |
113 const GrSwizzle& configTextureSwizzle(GrPixelConfig config) const { | 114 const char* getSwizzleMap(GrPixelConfig config) const { return fConfigSwizzl
e[config]; } |
114 return fConfigTextureSwizzle[config]; | |
115 } | |
116 | 115 |
117 GrGLSLGeneration generation() const { return fGLSLGeneration; } | 116 GrGLSLGeneration generation() const { return fGLSLGeneration; } |
118 | 117 |
119 /** | 118 /** |
120 * Returns a string containing the caps info. | 119 * Returns a string containing the caps info. |
121 */ | 120 */ |
122 SkString dump() const override; | 121 SkString dump() const override; |
123 | 122 |
124 private: | 123 private: |
125 void onApplyOptionsOverrides(const GrContextOptions& options) override; | 124 void onApplyOptionsOverrides(const GrContextOptions& options) override; |
(...skipping 16 matching lines...) Expand all Loading... |
142 const char* fShaderDerivativeExtensionString; | 141 const char* fShaderDerivativeExtensionString; |
143 const char* fFragCoordConventionsExtensionString; | 142 const char* fFragCoordConventionsExtensionString; |
144 const char* fSecondaryOutputExtensionString; | 143 const char* fSecondaryOutputExtensionString; |
145 const char* fExternalTextureExtensionString; | 144 const char* fExternalTextureExtensionString; |
146 | 145 |
147 const char* fFBFetchColorName; | 146 const char* fFBFetchColorName; |
148 const char* fFBFetchExtensionString; | 147 const char* fFBFetchExtensionString; |
149 | 148 |
150 AdvBlendEqInteraction fAdvBlendEqInteraction; | 149 AdvBlendEqInteraction fAdvBlendEqInteraction; |
151 | 150 |
152 GrSwizzle fConfigTextureSwizzle[kGrPixelConfigCnt]; | 151 bool fMustSwizzleInShader; |
| 152 const char* fConfigSwizzle[kGrPixelConfigCnt]; |
153 | 153 |
154 friend class GrGLCaps; // For initialization. | 154 friend class GrGLCaps; // For initialization. |
155 | 155 |
156 typedef GrShaderCaps INHERITED; | 156 typedef GrShaderCaps INHERITED; |
157 }; | 157 }; |
158 | 158 |
| 159 |
159 #endif | 160 #endif |
OLD | NEW |