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 23 matching lines...) Expand all Loading... |
34 * previous uniform state after a program change. | 34 * previous uniform state after a program change. |
35 */ | 35 */ |
36 class GrGLProgram : public SkRefCnt { | 36 class GrGLProgram : public SkRefCnt { |
37 public: | 37 public: |
38 SK_DECLARE_INST_COUNT(GrGLProgram) | 38 SK_DECLARE_INST_COUNT(GrGLProgram) |
39 | 39 |
40 typedef GrGLProgramBuilder::BuiltinUniformHandles BuiltinUniformHandles; | 40 typedef GrGLProgramBuilder::BuiltinUniformHandles BuiltinUniformHandles; |
41 | 41 |
42 static GrGLProgram* Create(GrGpuGL* gpu, | 42 static GrGLProgram* Create(GrGpuGL* gpu, |
43 const GrGLProgramDesc& desc, | 43 const GrGLProgramDesc& desc, |
| 44 const GrEffectStage* geometryProcessor, |
44 const GrEffectStage* colorStages[], | 45 const GrEffectStage* colorStages[], |
45 const GrEffectStage* coverageStages[]); | 46 const GrEffectStage* coverageStages[]); |
46 | 47 |
47 virtual ~GrGLProgram(); | 48 virtual ~GrGLProgram(); |
48 | 49 |
49 /** | 50 /** |
50 * Call to abandon GL objects owned by this program. | 51 * Call to abandon GL objects owned by this program. |
51 */ | 52 */ |
52 void abandon(); | 53 void abandon(); |
53 | 54 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 }; | 152 }; |
152 | 153 |
153 /** | 154 /** |
154 * 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 |
155 * 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 |
156 * 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 |
157 * stages come from GrGLProgramDesc::Build(). | 158 * stages come from GrGLProgramDesc::Build(). |
158 */ | 159 */ |
159 void setData(GrGpu::DrawType, | 160 void setData(GrGpu::DrawType, |
160 GrDrawState::BlendOptFlags, | 161 GrDrawState::BlendOptFlags, |
| 162 const GrEffectStage* geometryProcessor, |
161 const GrEffectStage* colorStages[], | 163 const GrEffectStage* colorStages[], |
162 const GrEffectStage* coverageStages[], | 164 const GrEffectStage* coverageStages[], |
163 const GrDeviceCoordTexture* dstCopy, // can be NULL | 165 const GrDeviceCoordTexture* dstCopy, // can be NULL |
164 SharedGLState*); | 166 SharedGLState*); |
165 | 167 |
166 private: | 168 private: |
167 typedef GrGLProgramDataManager::UniformHandle UniformHandle; | 169 typedef GrGLProgramDataManager::UniformHandle UniformHandle; |
168 | 170 |
169 GrGLProgram(GrGpuGL*, | 171 GrGLProgram(GrGpuGL*, |
170 const GrGLProgramDesc&, | 172 const GrGLProgramDesc&, |
(...skipping 13 matching lines...) Expand all Loading... |
184 // 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 |
185 void setMatrixAndRenderTargetHeight(GrGpu::DrawType drawType, const GrDrawSt
ate&); | 187 void setMatrixAndRenderTargetHeight(GrGpu::DrawType drawType, const GrDrawSt
ate&); |
186 | 188 |
187 // 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) |
188 MatrixState fMatrixState; | 190 MatrixState fMatrixState; |
189 GrColor fColor; | 191 GrColor fColor; |
190 GrColor fCoverage; | 192 GrColor fCoverage; |
191 int fDstCopyTexUnit; | 193 int fDstCopyTexUnit; |
192 | 194 |
193 BuiltinUniformHandles fBuiltinUniformHandles; | 195 BuiltinUniformHandles fBuiltinUniformHandles; |
| 196 SkAutoTUnref<GrGLProgramEffects> fGeometryProcessor; |
194 SkAutoTUnref<GrGLProgramEffects> fColorEffects; | 197 SkAutoTUnref<GrGLProgramEffects> fColorEffects; |
195 SkAutoTUnref<GrGLProgramEffects> fCoverageEffects; | 198 SkAutoTUnref<GrGLProgramEffects> fCoverageEffects; |
196 GrGLuint fProgramID; | 199 GrGLuint fProgramID; |
197 bool fHasVertexShader; | 200 bool fHasVertexShader; |
198 int fTexCoordSetCnt; | 201 int fTexCoordSetCnt; |
199 | 202 |
200 GrGLProgramDesc fDesc; | 203 GrGLProgramDesc fDesc; |
201 GrGpuGL* fGpu; | 204 GrGpuGL* fGpu; |
202 | 205 |
203 GrGLProgramDataManager fProgramDataManager; | 206 GrGLProgramDataManager fProgramDataManager; |
204 | 207 |
205 typedef SkRefCnt INHERITED; | 208 typedef SkRefCnt INHERITED; |
206 }; | 209 }; |
207 | 210 |
208 #endif | 211 #endif |
OLD | NEW |