OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 #ifndef GrGLSLFragmentShaderBuilder_DEFINED | 8 #ifndef GrGLSLFragmentShaderBuilder_DEFINED |
9 #define GrGLSLFragmentShaderBuilder_DEFINED | 9 #define GrGLSLFragmentShaderBuilder_DEFINED |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... | |
26 , fHasSecondaryOutput(false) { | 26 , fHasSecondaryOutput(false) { |
27 fSubstageIndices.push_back(0); | 27 fSubstageIndices.push_back(0); |
28 } | 28 } |
29 virtual ~GrGLSLFragmentBuilder() {} | 29 virtual ~GrGLSLFragmentBuilder() {} |
30 /** | 30 /** |
31 * Use of these features may require a GLSL extension to be enabled. Shaders may not compile | 31 * Use of these features may require a GLSL extension to be enabled. Shaders may not compile |
32 * if code is added that uses one of these features without calling enableFe ature() | 32 * if code is added that uses one of these features without calling enableFe ature() |
33 */ | 33 */ |
34 enum GLSLFeature { | 34 enum GLSLFeature { |
35 kStandardDerivatives_GLSLFeature = 0, | 35 kStandardDerivatives_GLSLFeature = 0, |
36 kExternalSampler_GLSLFeature = 1, | |
egdaniel
2015/11/20 21:57:43
is this public feature enum needed?
bsalomon
2015/11/20 22:43:55
Done.
| |
36 kLastGLSLFeature = kStandardDerivatives_GLSLFeature | 37 kLastGLSLFeature = kStandardDerivatives_GLSLFeature |
37 }; | 38 }; |
38 | 39 |
39 /** | 40 /** |
40 * If the feature is supported then true is returned and any necessary #exte nsion declarations | 41 * If the feature is supported then true is returned and any necessary #exte nsion declarations |
41 * are added to the shaders. If the feature is not supported then false will be returned. | 42 * are added to the shaders. If the feature is not supported then false will be returned. |
42 */ | 43 */ |
43 virtual bool enableFeature(GLSLFeature) = 0; | 44 virtual bool enableFeature(GLSLFeature) = 0; |
44 | 45 |
45 /** | 46 /** |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 | 166 |
166 void onFinalize() override; | 167 void onFinalize() override; |
167 | 168 |
168 /** | 169 /** |
169 * Features that should only be enabled by GrGLSLFragmentShaderBuilder itsel f. | 170 * Features that should only be enabled by GrGLSLFragmentShaderBuilder itsel f. |
170 */ | 171 */ |
171 enum GLSLPrivateFeature { | 172 enum GLSLPrivateFeature { |
172 kFragCoordConventions_GLSLPrivateFeature = kLastGLSLFeature + 1, | 173 kFragCoordConventions_GLSLPrivateFeature = kLastGLSLFeature + 1, |
173 kBlendEquationAdvanced_GLSLPrivateFeature, | 174 kBlendEquationAdvanced_GLSLPrivateFeature, |
174 kBlendFuncExtended_GLSLPrivateFeature, | 175 kBlendFuncExtended_GLSLPrivateFeature, |
176 kExternalTexture_GLSLPrivateFeature, | |
175 kLastGLSLPrivateFeature = kBlendFuncExtended_GLSLPrivateFeature | 177 kLastGLSLPrivateFeature = kBlendFuncExtended_GLSLPrivateFeature |
176 }; | 178 }; |
177 | 179 |
178 // Interpretation of FragPosKey when generating code | 180 // Interpretation of FragPosKey when generating code |
179 enum { | 181 enum { |
180 kNoFragPosRead_FragPosKey = 0, // The fragment positition wil l not be needed. | 182 kNoFragPosRead_FragPosKey = 0, // The fragment positition wil l not be needed. |
181 kTopLeftFragPosRead_FragPosKey = 0x1,// Read frag pos relative to t op-left. | 183 kTopLeftFragPosRead_FragPosKey = 0x1,// Read frag pos relative to t op-left. |
182 kBottomLeftFragPosRead_FragPosKey = 0x2,// Read frag pos relative to b ottom-left. | 184 kBottomLeftFragPosRead_FragPosKey = 0x2,// Read frag pos relative to b ottom-left. |
183 }; | 185 }; |
184 | 186 |
185 static const char* kDstTextureColorName; | 187 static const char* kDstTextureColorName; |
186 | 188 |
187 bool fSetupFragPosition; | 189 bool fSetupFragPosition; |
188 bool fTopLeftFragPosRead; | 190 bool fTopLeftFragPosRead; |
189 int fCustomColorOutputIndex; | 191 int fCustomColorOutputIndex; |
190 | 192 |
191 // some state to verify shaders and effects are consistent, this is reset be tween effects by | 193 // some state to verify shaders and effects are consistent, this is reset be tween effects by |
192 // the program creator | 194 // the program creator |
193 bool fHasReadDstColor; | 195 bool fHasReadDstColor; |
194 bool fHasReadFragmentPosition; | 196 bool fHasReadFragmentPosition; |
195 | 197 |
196 friend class GrGLProgramBuilder; | 198 friend class GrGLProgramBuilder; |
197 | 199 |
198 typedef GrGLSLXPFragmentBuilder INHERITED; | 200 typedef GrGLSLXPFragmentBuilder INHERITED; |
199 }; | 201 }; |
200 | 202 |
201 #endif | 203 #endif |
OLD | NEW |