OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 GrGLProgram_DEFINED | 9 #ifndef GrGLProgram_DEFINED |
10 #define GrGLProgram_DEFINED | 10 #define GrGLProgram_DEFINED |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 const GrEffectStage* coverageStages[]); | 165 const GrEffectStage* coverageStages[]); |
166 | 166 |
167 bool succeeded() const { return 0 != fProgramID; } | 167 bool succeeded() const { return 0 != fProgramID; } |
168 | 168 |
169 /** | 169 /** |
170 * This is the heavy initialization routine for building a GLProgram. colorS
tages and | 170 * This is the heavy initialization routine for building a GLProgram. colorS
tages and |
171 * coverageStages correspond to the output of GrGLProgramDesc::Build(). | 171 * coverageStages correspond to the output of GrGLProgramDesc::Build(). |
172 */ | 172 */ |
173 bool genProgram(const GrEffectStage* colorStages[], const GrEffectStage* cov
erageStages[]); | 173 bool genProgram(const GrEffectStage* colorStages[], const GrEffectStage* cov
erageStages[]); |
174 | 174 |
175 GrSLConstantVec genInputColor(GrGLShaderBuilder* builder, SkString* inColor)
; | |
176 | |
177 GrSLConstantVec genInputCoverage(GrGLShaderBuilder* builder, SkString* inCov
erage); | |
178 | |
179 void genGeometryShader(GrGLShaderBuilder::VertexBuilder* vertexBuilder) cons
t; | |
180 | |
181 // Creates a GL program ID, binds shader attributes to GL vertex attrs, and
links the program | |
182 bool bindOutputsAttribsAndLinkProgram(const GrGLShaderBuilder& builder, | |
183 bool bindColorOut, | |
184 bool bindDualSrcOut); | |
185 | |
186 // Sets the texture units for samplers | 175 // Sets the texture units for samplers |
187 void initSamplerUniforms(); | 176 void initSamplerUniforms(); |
188 void initEffectSamplerUniforms(EffectAndSamplers* effect, int* texUnitIdx); | 177 void initEffectSamplerUniforms(EffectAndSamplers* effect, int* texUnitIdx); |
189 | 178 |
190 bool compileShaders(const GrGLShaderBuilder& builder); | |
191 | |
192 const char* adjustInColor(const SkString& inColor) const; | |
193 | |
194 // Helper for setData(). | 179 // Helper for setData(). |
195 void setEffectData(const GrEffectStage& stage, const EffectAndSamplers& effe
ct); | 180 void setEffectData(const GrEffectStage& stage, const EffectAndSamplers& effe
ct); |
196 | 181 |
197 // Helper for setData(). Makes GL calls to specify the initial color when th
ere is not | 182 // Helper for setData(). Makes GL calls to specify the initial color when th
ere is not |
198 // per-vertex colors. | 183 // per-vertex colors. |
199 void setColor(const GrDrawState&, GrColor color, SharedGLState*); | 184 void setColor(const GrDrawState&, GrColor color, SharedGLState*); |
200 | 185 |
201 // Helper for setData(). Makes GL calls to specify the initial coverage when
there is not | 186 // Helper for setData(). Makes GL calls to specify the initial coverage when
there is not |
202 // per-vertex coverages. | 187 // per-vertex coverages. |
203 void setCoverage(const GrDrawState&, GrColor coverage, SharedGLState*); | 188 void setCoverage(const GrDrawState&, GrColor coverage, SharedGLState*); |
204 | 189 |
205 // Helper for setData() that sets the view matrix and loads the render targe
t height uniform | 190 // Helper for setData() that sets the view matrix and loads the render targe
t height uniform |
206 void setMatrixAndRenderTargetHeight(const GrDrawState&); | 191 void setMatrixAndRenderTargetHeight(const GrDrawState&); |
207 | 192 |
208 // GL IDs | 193 // GL program ID |
209 GrGLuint fVShaderID; | |
210 GrGLuint fGShaderID; | |
211 GrGLuint fFShaderID; | |
212 GrGLuint fProgramID; | 194 GrGLuint fProgramID; |
213 | 195 |
214 // these reflect the current values of uniforms (GL uniform values travel wi
th program) | 196 // these reflect the current values of uniforms (GL uniform values travel wi
th program) |
215 MatrixState fMatrixState; | 197 MatrixState fMatrixState; |
216 GrColor fColor; | 198 GrColor fColor; |
217 GrColor fCoverage; | 199 GrColor fCoverage; |
218 GrColor fColorFilterColor; | 200 GrColor fColorFilterColor; |
219 int fDstCopyTexUnit; | 201 int fDstCopyTexUnit; |
220 | 202 |
221 SkTArray<EffectAndSamplers> fColorEffects; | 203 SkTArray<EffectAndSamplers> fColorEffects; |
222 SkTArray<EffectAndSamplers> fCoverageEffects; | 204 SkTArray<EffectAndSamplers> fCoverageEffects; |
223 | 205 |
224 GrGLProgramDesc fDesc; | 206 GrGLProgramDesc fDesc; |
225 GrGpuGL* fGpu; | 207 GrGpuGL* fGpu; |
226 | 208 |
227 GrGLUniformManager fUniformManager; | 209 GrGLUniformManager fUniformManager; |
228 UniformHandles fUniformHandles; | 210 UniformHandles fUniformHandles; |
229 | 211 |
230 typedef SkRefCnt INHERITED; | 212 typedef SkRefCnt INHERITED; |
231 }; | 213 }; |
232 | 214 |
233 #endif | 215 #endif |
OLD | NEW |