| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 } | 148 } |
| 149 } | 149 } |
| 150 }; | 150 }; |
| 151 | 151 |
| 152 /** | 152 /** |
| 153 * This function uploads uniforms and calls each GrGLEffect's setData. It is
called before a | 153 * This function uploads uniforms and calls each GrGLEffect's setData. It is
called before a |
| 154 * draw occurs using the program after the program has already been bound. I
t also uses the | 154 * draw occurs using the program after the program has already been bound. I
t also uses the |
| 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(GrGpu::DrawType, |
| 159 GrDrawState::BlendOptFlags, |
| 159 const GrEffectStage* colorStages[], | 160 const GrEffectStage* colorStages[], |
| 160 const GrEffectStage* coverageStages[], | 161 const GrEffectStage* coverageStages[], |
| 161 const GrDeviceCoordTexture* dstCopy, // can be NULL | 162 const GrDeviceCoordTexture* dstCopy, // can be NULL |
| 162 SharedGLState*); | 163 SharedGLState*); |
| 163 | 164 |
| 164 private: | 165 private: |
| 165 typedef GrGLUniformManager::UniformHandle UniformHandle; | 166 typedef GrGLUniformManager::UniformHandle UniformHandle; |
| 166 | 167 |
| 167 GrGLProgram(GrGpuGL*, | 168 GrGLProgram(GrGpuGL*, |
| 168 const GrGLProgramDesc&, | 169 const GrGLProgramDesc&, |
| 169 GrGLUniformManager*, | 170 GrGLUniformManager*, |
| 170 const GrGLShaderBuilder::GenProgramOutput&); | 171 const GrGLShaderBuilder::GenProgramOutput&); |
| 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 GrGLShaderBuilder::GenProgramOutput fBuilderOutput; | 193 GrGLShaderBuilder::GenProgramOutput fBuilderOutput; |
| 193 | 194 |
| 194 GrGLProgramDesc fDesc; | 195 GrGLProgramDesc fDesc; |
| 195 GrGpuGL* fGpu; | 196 GrGpuGL* fGpu; |
| 196 | 197 |
| 197 SkAutoTUnref<GrGLUniformManager> fUniformManager; | 198 SkAutoTUnref<GrGLUniformManager> fUniformManager; |
| 198 | 199 |
| 199 typedef SkRefCnt INHERITED; | 200 typedef SkRefCnt INHERITED; |
| 200 }; | 201 }; |
| 201 | 202 |
| 202 #endif | 203 #endif |
| OLD | NEW |