| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 */ | 55 */ |
| 56 void overrideBlend(GrBlendCoeff* srcCoeff, GrBlendCoeff* dstCoeff) const; | 56 void overrideBlend(GrBlendCoeff* srcCoeff, GrBlendCoeff* dstCoeff) const; |
| 57 | 57 |
| 58 const GrGLProgramDesc& getDesc() { return fDesc; } | 58 const GrGLProgramDesc& getDesc() { return fDesc; } |
| 59 | 59 |
| 60 /** | 60 /** |
| 61 * Gets the GL program ID for this program. | 61 * Gets the GL program ID for this program. |
| 62 */ | 62 */ |
| 63 GrGLuint programID() const { return fProgramID; } | 63 GrGLuint programID() const { return fProgramID; } |
| 64 | 64 |
| 65 bool hasVertexShader() const { return fHasVertexShader; } |
| 66 |
| 65 /** | 67 /** |
| 66 * Some GL state that is relevant to programs is not stored per-program. In
particular color | 68 * Some GL state that is relevant to programs is not stored per-program. In
particular color |
| 67 * and coverage attributes can be global state. This struct is read and upda
ted by | 69 * and coverage attributes can be global state. This struct is read and upda
ted by |
| 68 * GrGLProgram::setColor and GrGLProgram::setCoverage to allow us to avoid s
etting this state | 70 * GrGLProgram::setColor and GrGLProgram::setCoverage to allow us to avoid s
etting this state |
| 69 * redundantly. | 71 * redundantly. |
| 70 */ | 72 */ |
| 71 struct SharedGLState { | 73 struct SharedGLState { |
| 72 GrColor fConstAttribColor; | 74 GrColor fConstAttribColor; |
| 73 int fConstAttribColorIndex; | 75 int fConstAttribColorIndex; |
| 74 GrColor fConstAttribCoverage; | 76 GrColor fConstAttribCoverage; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 const GrGLProgramDesc& desc, | 155 const GrGLProgramDesc& desc, |
| 154 const GrEffectStage* colorStages[], | 156 const GrEffectStage* colorStages[], |
| 155 const GrEffectStage* coverageStages[]); | 157 const GrEffectStage* coverageStages[]); |
| 156 | 158 |
| 157 bool succeeded() const { return 0 != fProgramID; } | 159 bool succeeded() const { return 0 != fProgramID; } |
| 158 | 160 |
| 159 /** | 161 /** |
| 160 * This is the heavy initialization routine for building a GLProgram. colorS
tages and | 162 * This is the heavy initialization routine for building a GLProgram. colorS
tages and |
| 161 * coverageStages correspond to the output of GrGLProgramDesc::Build(). | 163 * coverageStages correspond to the output of GrGLProgramDesc::Build(). |
| 162 */ | 164 */ |
| 163 bool genProgram(const GrEffectStage* colorStages[], const GrEffectStage* cov
erageStages[]); | 165 bool genProgram(GrGLShaderBuilder* builder, |
| 166 const GrEffectStage* colorStages[], |
| 167 const GrEffectStage* coverageStages[]); |
| 164 | 168 |
| 165 // Sets the texture units for samplers | 169 // Sets the texture units for samplers |
| 166 void initSamplerUniforms(); | 170 void initSamplerUniforms(); |
| 167 | 171 |
| 168 // Helper for setData(). Makes GL calls to specify the initial color when th
ere is not | 172 // Helper for setData(). Makes GL calls to specify the initial color when th
ere is not |
| 169 // per-vertex colors. | 173 // per-vertex colors. |
| 170 void setColor(const GrDrawState&, GrColor color, SharedGLState*); | 174 void setColor(const GrDrawState&, GrColor color, SharedGLState*); |
| 171 | 175 |
| 172 // Helper for setData(). Makes GL calls to specify the initial coverage when
there is not | 176 // Helper for setData(). Makes GL calls to specify the initial coverage when
there is not |
| 173 // per-vertex coverages. | 177 // per-vertex coverages. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 188 | 192 |
| 189 SkAutoTDelete<GrGLProgramEffects> fColorEffects; | 193 SkAutoTDelete<GrGLProgramEffects> fColorEffects; |
| 190 SkAutoTDelete<GrGLProgramEffects> fCoverageEffects; | 194 SkAutoTDelete<GrGLProgramEffects> fCoverageEffects; |
| 191 | 195 |
| 192 GrGLProgramDesc fDesc; | 196 GrGLProgramDesc fDesc; |
| 193 GrGpuGL* fGpu; | 197 GrGpuGL* fGpu; |
| 194 | 198 |
| 195 GrGLUniformManager fUniformManager; | 199 GrGLUniformManager fUniformManager; |
| 196 UniformHandles fUniformHandles; | 200 UniformHandles fUniformHandles; |
| 197 | 201 |
| 202 bool fHasVertexShader; |
| 203 int fNumTexCoordSets; |
| 204 |
| 198 typedef SkRefCnt INHERITED; | 205 typedef SkRefCnt INHERITED; |
| 199 }; | 206 }; |
| 200 | 207 |
| 201 #endif | 208 #endif |
| OLD | NEW |