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