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 kPixelLocalStorage_GLSLFeature = 1, | 36 kLastGLSLFeature = kStandardDerivatives_GLSLFeature |
37 kLastGLSLFeature = kPixelLocalStorage_GLSLFeature | |
38 }; | 37 }; |
39 | 38 |
40 /** | 39 /** |
41 * If the feature is supported then true is returned and any necessary #exte
nsion declarations | 40 * If the feature is supported then true is returned and any necessary #exte
nsion declarations |
42 * are added to the shaders. If the feature is not supported then false will
be returned. | 41 * are added to the shaders. If the feature is not supported then false will
be returned. |
43 */ | 42 */ |
44 virtual bool enableFeature(GLSLFeature) = 0; | 43 virtual bool enableFeature(GLSLFeature) = 0; |
45 | 44 |
46 /** | 45 /** |
47 * This returns a variable name to access the 2D, perspective correct versio
n of the coords in | 46 * This returns a variable name to access the 2D, perspective correct versio
n of the coords in |
(...skipping 12 matching lines...) Expand all Loading... |
60 * on a child proc. | 59 * on a child proc. |
61 */ | 60 */ |
62 void onBeforeChildProcEmitCode(); | 61 void onBeforeChildProcEmitCode(); |
63 void onAfterChildProcEmitCode(); | 62 void onAfterChildProcEmitCode(); |
64 | 63 |
65 const SkString& getMangleString() const { return fMangleString; } | 64 const SkString& getMangleString() const { return fMangleString; } |
66 | 65 |
67 bool hasCustomColorOutput() const { return fHasCustomColorOutput; } | 66 bool hasCustomColorOutput() const { return fHasCustomColorOutput; } |
68 bool hasSecondaryOutput() const { return fHasSecondaryOutput; } | 67 bool hasSecondaryOutput() const { return fHasSecondaryOutput; } |
69 | 68 |
70 void declAppendf(const char* fmt, ...); | |
71 | |
72 protected: | 69 protected: |
73 bool fHasCustomColorOutput; | 70 bool fHasCustomColorOutput; |
74 bool fHasSecondaryOutput; | 71 bool fHasSecondaryOutput; |
75 | 72 |
76 private: | 73 private: |
77 /* | 74 /* |
78 * State that tracks which child proc in the proc tree is currently emitting
code. This is | 75 * State that tracks which child proc in the proc tree is currently emitting
code. This is |
79 * used to update the fMangleString, which is used to mangle the names of un
iforms and functions | 76 * used to update the fMangleString, which is used to mangle the names of un
iforms and functions |
80 * emitted by the proc. fSubstageIndices is a stack: its count indicates ho
w many levels deep | 77 * emitted by the proc. fSubstageIndices is a stack: its count indicates ho
w many levels deep |
81 * we are in the tree, and its second-to-last value is the index of the chil
d proc at that | 78 * we are in the tree, and its second-to-last value is the index of the chil
d proc at that |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 bool fHasReadDstColor; | 194 bool fHasReadDstColor; |
198 bool fHasReadFragmentPosition; | 195 bool fHasReadFragmentPosition; |
199 | 196 |
200 friend class GrGLSLProgramBuilder; | 197 friend class GrGLSLProgramBuilder; |
201 friend class GrGLProgramBuilder; | 198 friend class GrGLProgramBuilder; |
202 | 199 |
203 typedef GrGLSLXPFragmentBuilder INHERITED; | 200 typedef GrGLSLXPFragmentBuilder INHERITED; |
204 }; | 201 }; |
205 | 202 |
206 #endif | 203 #endif |
OLD | NEW |