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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 } | 149 } |
150 } | 150 } |
151 }; | 151 }; |
152 | 152 |
153 /** | 153 /** |
154 * This function uploads uniforms and calls each GrGLEffect's setData. It is
called before a | 154 * This function uploads uniforms and calls each GrGLEffect's setData. It is
called before a |
155 * draw occurs using the program after the program has already been bound. I
t also uses the | 155 * draw occurs using the program after the program has already been bound. I
t also uses the |
156 * GrGpuGL object to bind the textures required by the GrGLEffects. The colo
r and coverage | 156 * GrGpuGL object to bind the textures required by the GrGLEffects. The colo
r and coverage |
157 * stages come from GrGLProgramDesc::Build(). | 157 * stages come from GrGLProgramDesc::Build(). |
158 */ | 158 */ |
159 void setData(GrDrawState::BlendOptFlags, | 159 void setData(GrGpu::DrawType, |
| 160 GrDrawState::BlendOptFlags, |
160 const GrEffectStage* colorStages[], | 161 const GrEffectStage* colorStages[], |
161 const GrEffectStage* coverageStages[], | 162 const GrEffectStage* coverageStages[], |
162 const GrDeviceCoordTexture* dstCopy, // can be NULL | 163 const GrDeviceCoordTexture* dstCopy, // can be NULL |
163 SharedGLState*); | 164 SharedGLState*); |
164 | 165 |
165 private: | 166 private: |
166 typedef GrGLProgramDataManager::UniformHandle UniformHandle; | 167 typedef GrGLProgramDataManager::UniformHandle UniformHandle; |
167 | 168 |
168 GrGLProgram(GrGpuGL*, | 169 GrGLProgram(GrGpuGL*, |
169 const GrGLProgramDesc&, | 170 const GrGLProgramDesc&, |
170 const GrGLShaderBuilder&); | 171 const GrGLShaderBuilder&); |
171 | 172 |
172 // Sets the texture units for samplers. | 173 // Sets the texture units for samplers. |
173 void initSamplerUniforms(); | 174 void initSamplerUniforms(); |
174 | 175 |
175 // Helper for setData(). Makes GL calls to specify the initial color when th
ere is not | 176 // Helper for setData(). Makes GL calls to specify the initial color when th
ere is not |
176 // per-vertex colors. | 177 // per-vertex colors. |
177 void setColor(const GrDrawState&, GrColor color, SharedGLState*); | 178 void setColor(const GrDrawState&, GrColor color, SharedGLState*); |
178 | 179 |
179 // Helper for setData(). Makes GL calls to specify the initial coverage when
there is not | 180 // Helper for setData(). Makes GL calls to specify the initial coverage when
there is not |
180 // per-vertex coverages. | 181 // per-vertex coverages. |
181 void setCoverage(const GrDrawState&, GrColor coverage, SharedGLState*); | 182 void setCoverage(const GrDrawState&, GrColor coverage, SharedGLState*); |
182 | 183 |
183 // Helper for setData() that sets the view matrix and loads the render targe
t height uniform | 184 // Helper for setData() that sets the view matrix and loads the render targe
t height uniform |
184 void setMatrixAndRenderTargetHeight(const GrDrawState&); | 185 void setMatrixAndRenderTargetHeight(GrGpu::DrawType drawType, const GrDrawSt
ate&); |
185 | 186 |
186 // these reflect the current values of uniforms (GL uniform values travel wi
th program) | 187 // these reflect the current values of uniforms (GL uniform values travel wi
th program) |
187 MatrixState fMatrixState; | 188 MatrixState fMatrixState; |
188 GrColor fColor; | 189 GrColor fColor; |
189 GrColor fCoverage; | 190 GrColor fCoverage; |
190 int fDstCopyTexUnit; | 191 int fDstCopyTexUnit; |
191 | 192 |
192 BuiltinUniformHandles fBuiltinUniformHandles; | 193 BuiltinUniformHandles fBuiltinUniformHandles; |
193 SkAutoTUnref<GrGLProgramEffects> fColorEffects; | 194 SkAutoTUnref<GrGLProgramEffects> fColorEffects; |
194 SkAutoTUnref<GrGLProgramEffects> fCoverageEffects; | 195 SkAutoTUnref<GrGLProgramEffects> fCoverageEffects; |
195 GrGLuint fProgramID; | 196 GrGLuint fProgramID; |
196 bool fHasVertexShader; | 197 bool fHasVertexShader; |
197 int fTexCoordSetCnt; | 198 int fTexCoordSetCnt; |
198 | 199 |
199 GrGLProgramDesc fDesc; | 200 GrGLProgramDesc fDesc; |
200 GrGpuGL* fGpu; | 201 GrGpuGL* fGpu; |
201 | 202 |
202 GrGLProgramDataManager fProgramDataManager; | 203 GrGLProgramDataManager fProgramDataManager; |
203 | 204 |
204 typedef SkRefCnt INHERITED; | 205 typedef SkRefCnt INHERITED; |
205 }; | 206 }; |
206 | 207 |
207 #endif | 208 #endif |
OLD | NEW |