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