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 GrGLFragmentShaderBuilder_DEFINED | 8 #ifndef GrGLFragmentShaderBuilder_DEFINED |
9 #define GrGLFragmentShaderBuilder_DEFINED | 9 #define GrGLFragmentShaderBuilder_DEFINED |
10 | 10 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 private: | 74 private: |
75 typedef GrGLFragmentBuilder INHERITED; | 75 typedef GrGLFragmentBuilder INHERITED; |
76 }; | 76 }; |
77 | 77 |
78 // TODO rename to Fragment Builder | 78 // TODO rename to Fragment Builder |
79 class GrGLFragmentShaderBuilder : public GrGLXPFragmentBuilder { | 79 class GrGLFragmentShaderBuilder : public GrGLXPFragmentBuilder { |
80 public: | 80 public: |
81 typedef uint8_t DstReadKey; | 81 typedef uint8_t DstReadKey; |
82 typedef uint8_t FragPosKey; | 82 typedef uint8_t FragPosKey; |
83 | 83 |
84 /** Returns a key for adding code to read the dst texture color in service o
f effects that | 84 /** Returns a key for adding code to read the copy-of-dst color in service
of effects that |
85 require reading the dst. It must not return 0 because 0 indicates that t
here is no dst | 85 require reading the dst. It must not return 0 because 0 indicates that t
here is no dst |
86 texture at all (in which case this function should not be called). */ | 86 copy read at all (in which case this function should not be called). */ |
87 static DstReadKey KeyForDstRead(const GrTexture* dsttexture, const GrGLCaps&
); | 87 static DstReadKey KeyForDstRead(const GrTexture* dstCopy, const GrGLCaps&); |
88 | 88 |
89 /** Returns a key for reading the fragment location. This should only be cal
led if there is an | 89 /** Returns a key for reading the fragment location. This should only be cal
led if there is an |
90 effect that will requires the fragment position. If the fragment position
is not required, | 90 effect that will requires the fragment position. If the fragment position
is not required, |
91 the key is 0. */ | 91 the key is 0. */ |
92 static FragPosKey KeyForFragmentPosition(const GrRenderTarget* dst, const Gr
GLCaps&); | 92 static FragPosKey KeyForFragmentPosition(const GrRenderTarget* dst, const Gr
GLCaps&); |
93 | 93 |
94 GrGLFragmentShaderBuilder(GrGLProgramBuilder* program, uint8_t fragPosKey); | 94 GrGLFragmentShaderBuilder(GrGLProgramBuilder* program, uint8_t fragPosKey); |
95 | 95 |
96 // true public interface, defined explicitly in the abstract interfaces abov
e | 96 // true public interface, defined explicitly in the abstract interfaces abov
e |
97 bool enableFeature(GLSLFeature) override; | 97 bool enableFeature(GLSLFeature) override; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 kTopLeftOrigin_DstReadKeyBit = 0x4, // Set if dst-copy origin is top-
left. | 142 kTopLeftOrigin_DstReadKeyBit = 0x4, // Set if dst-copy origin is top-
left. |
143 }; | 143 }; |
144 | 144 |
145 // Interpretation of FragPosKey when generating code | 145 // Interpretation of FragPosKey when generating code |
146 enum { | 146 enum { |
147 kNoFragPosRead_FragPosKey = 0, // The fragment positition wil
l not be needed. | 147 kNoFragPosRead_FragPosKey = 0, // The fragment positition wil
l not be needed. |
148 kTopLeftFragPosRead_FragPosKey = 0x1,// Read frag pos relative to t
op-left. | 148 kTopLeftFragPosRead_FragPosKey = 0x1,// Read frag pos relative to t
op-left. |
149 kBottomLeftFragPosRead_FragPosKey = 0x2,// Read frag pos relative to b
ottom-left. | 149 kBottomLeftFragPosRead_FragPosKey = 0x2,// Read frag pos relative to b
ottom-left. |
150 }; | 150 }; |
151 | 151 |
152 static const char* kDstTextureColorName; | 152 static const char* kDstCopyColorName; |
153 | 153 |
154 bool fHasCustomColorOutput; | 154 bool fHasCustomColorOutput; |
155 bool fHasSecondaryOutput; | 155 bool fHasSecondaryOutput; |
156 bool fSetupFragPosition; | 156 bool fSetupFragPosition; |
157 bool fTopLeftFragPosRead; | 157 bool fTopLeftFragPosRead; |
158 int fCustomColorOutputIndex; | 158 int fCustomColorOutputIndex; |
159 | 159 |
160 // some state to verify shaders and effects are consistent, this is reset be
tween effects by | 160 // some state to verify shaders and effects are consistent, this is reset be
tween effects by |
161 // the program creator | 161 // the program creator |
162 bool fHasReadDstColor; | 162 bool fHasReadDstColor; |
163 bool fHasReadFragmentPosition; | 163 bool fHasReadFragmentPosition; |
164 | 164 |
165 friend class GrGLProgramBuilder; | 165 friend class GrGLProgramBuilder; |
166 | 166 |
167 typedef GrGLXPFragmentBuilder INHERITED; | 167 typedef GrGLXPFragmentBuilder INHERITED; |
168 }; | 168 }; |
169 | 169 |
170 #endif | 170 #endif |
OLD | NEW |