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 |
11 | 11 |
12 #include "GrDrawState.h" | 12 #include "GrDrawState.h" |
13 #include "GrGLContext.h" | 13 #include "GrGLContext.h" |
14 #include "GrGLProgramDesc.h" | 14 #include "GrGLProgramDesc.h" |
15 #include "GrGLShaderBuilder.h" | 15 #include "GrGLShaderBuilder.h" |
16 #include "GrGLSL.h" | 16 #include "GrGLSL.h" |
17 #include "GrGLTexture.h" | 17 #include "GrGLTexture.h" |
18 #include "GrGLUniformManager.h" | 18 #include "GrGLProgramResourceManager.h" |
19 | 19 |
20 #include "SkString.h" | 20 #include "SkString.h" |
21 #include "SkXfermode.h" | 21 #include "SkXfermode.h" |
22 | 22 |
23 class GrBinHashKeyBuilder; | 23 class GrBinHashKeyBuilder; |
24 class GrGLEffect; | 24 class GrGLEffect; |
25 class GrGLProgramEffects; | 25 class GrGLProgramEffects; |
26 class GrGLShaderBuilder; | 26 class GrGLShaderBuilder; |
27 | 27 |
28 /** | 28 /** |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 * GrGpuGL object to bind the textures required by the GrGLEffects. The colo
r and coverage | 155 * GrGpuGL object to bind the textures required by the GrGLEffects. The colo
r and coverage |
156 * stages come from GrGLProgramDesc::Build(). | 156 * stages come from GrGLProgramDesc::Build(). |
157 */ | 157 */ |
158 void setData(GrDrawState::BlendOptFlags, | 158 void setData(GrDrawState::BlendOptFlags, |
159 const GrEffectStage* colorStages[], | 159 const GrEffectStage* colorStages[], |
160 const GrEffectStage* coverageStages[], | 160 const GrEffectStage* coverageStages[], |
161 const GrDeviceCoordTexture* dstCopy, // can be NULL | 161 const GrDeviceCoordTexture* dstCopy, // can be NULL |
162 SharedGLState*); | 162 SharedGLState*); |
163 | 163 |
164 private: | 164 private: |
165 typedef GrGLUniformManager::UniformHandle UniformHandle; | 165 typedef GrGLProgramResourceManager::UniformHandle UniformHandle; |
166 | 166 |
167 GrGLProgram(GrGpuGL*, | 167 GrGLProgram(GrGpuGL*, |
168 const GrGLProgramDesc&, | 168 const GrGLProgramDesc&, |
169 GrGLUniformManager*, | 169 GrGLProgramResourceManager*, |
170 const GrGLShaderBuilder::GenProgramOutput&); | 170 const GrGLShaderBuilder::GenProgramOutput&); |
171 | 171 |
172 // Sets the texture units for samplers. | 172 // Sets the texture units for samplers. |
173 void initSamplerUniforms(); | 173 void initSamplerUniforms(); |
174 | 174 |
175 // Helper for setData(). Makes GL calls to specify the initial color when th
ere is not | 175 // Helper for setData(). Makes GL calls to specify the initial color when th
ere is not |
176 // per-vertex colors. | 176 // per-vertex colors. |
177 void setColor(const GrDrawState&, GrColor color, SharedGLState*); | 177 void setColor(const GrDrawState&, GrColor color, SharedGLState*); |
178 | 178 |
179 // Helper for setData(). Makes GL calls to specify the initial coverage when
there is not | 179 // Helper for setData(). Makes GL calls to specify the initial coverage when
there is not |
180 // per-vertex coverages. | 180 // per-vertex coverages. |
181 void setCoverage(const GrDrawState&, GrColor coverage, SharedGLState*); | 181 void setCoverage(const GrDrawState&, GrColor coverage, SharedGLState*); |
182 | 182 |
183 // Helper for setData() that sets the view matrix and loads the render targe
t height uniform | 183 // Helper for setData() that sets the view matrix and loads the render targe
t height uniform |
184 void setMatrixAndRenderTargetHeight(const GrDrawState&); | 184 void setMatrixAndRenderTargetHeight(const GrDrawState&); |
185 | 185 |
186 // these reflect the current values of uniforms (GL uniform values travel wi
th program) | 186 // these reflect the current values of uniforms (GL uniform values travel wi
th program) |
187 MatrixState fMatrixState; | 187 MatrixState fMatrixState; |
188 GrColor fColor; | 188 GrColor fColor; |
189 GrColor fCoverage; | 189 GrColor fCoverage; |
190 int fDstCopyTexUnit; | 190 int fDstCopyTexUnit; |
191 | 191 |
192 GrGLShaderBuilder::GenProgramOutput fBuilderOutput; | 192 GrGLShaderBuilder::GenProgramOutput fBuilderOutput; |
193 | 193 |
194 GrGLProgramDesc fDesc; | 194 GrGLProgramDesc fDesc; |
195 GrGpuGL* fGpu; | 195 GrGpuGL* fGpu; |
196 | 196 |
197 SkAutoTUnref<GrGLUniformManager> fUniformManager; | 197 SkAutoTUnref<GrGLProgramResourceManager> fProgramResourceManager; |
198 | 198 |
199 typedef SkRefCnt INHERITED; | 199 typedef SkRefCnt INHERITED; |
200 }; | 200 }; |
201 | 201 |
202 #endif | 202 #endif |
OLD | NEW |