OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #ifndef GrGLShaderBuilder_DEFINED | 8 #ifndef GrGLShaderBuilder_DEFINED |
9 #define GrGLShaderBuilder_DEFINED | 9 #define GrGLShaderBuilder_DEFINED |
10 | 10 |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 int effectCnt, | 248 int effectCnt, |
249 GrGLSLExpr4* inOutFSColor); | 249 GrGLSLExpr4* inOutFSColor); |
250 | 250 |
251 virtual bool compileAndAttachShaders(GrGLuint programId, SkTDArray<GrGLuint>
* shaderIds) const; | 251 virtual bool compileAndAttachShaders(GrGLuint programId, SkTDArray<GrGLuint>
* shaderIds) const; |
252 virtual void bindProgramLocations(GrGLuint programId) const; | 252 virtual void bindProgramLocations(GrGLuint programId) const; |
253 | 253 |
254 void appendDecls(const VarArray&, SkString*) const; | 254 void appendDecls(const VarArray&, SkString*) const; |
255 void appendUniformDecls(ShaderVisibility, SkString*) const; | 255 void appendUniformDecls(ShaderVisibility, SkString*) const; |
256 | 256 |
257 private: | 257 private: |
258 class CodeStage : public SkNoncopyable { | 258 class CodeStage : SkNoncopyable { |
259 public: | 259 public: |
260 CodeStage() : fNextIndex(0), fCurrentIndex(-1), fEffectStage(NULL) {} | 260 CodeStage() : fNextIndex(0), fCurrentIndex(-1), fEffectStage(NULL) {} |
261 | 261 |
262 bool inStageCode() const { | 262 bool inStageCode() const { |
263 this->validate(); | 263 this->validate(); |
264 return NULL != fEffectStage; | 264 return NULL != fEffectStage; |
265 } | 265 } |
266 | 266 |
267 const GrEffectStage* effectStage() const { | 267 const GrEffectStage* effectStage() const { |
268 this->validate(); | 268 this->validate(); |
269 return fEffectStage; | 269 return fEffectStage; |
270 } | 270 } |
271 | 271 |
272 int stageIndex() const { | 272 int stageIndex() const { |
273 this->validate(); | 273 this->validate(); |
274 return fCurrentIndex; | 274 return fCurrentIndex; |
275 } | 275 } |
276 | 276 |
277 class AutoStageRestore : public SkNoncopyable { | 277 class AutoStageRestore : SkNoncopyable { |
278 public: | 278 public: |
279 AutoStageRestore(CodeStage* codeStage, const GrEffectStage* newStage
) { | 279 AutoStageRestore(CodeStage* codeStage, const GrEffectStage* newStage
) { |
280 SkASSERT(NULL != codeStage); | 280 SkASSERT(NULL != codeStage); |
281 fSavedIndex = codeStage->fCurrentIndex; | 281 fSavedIndex = codeStage->fCurrentIndex; |
282 fSavedEffectStage = codeStage->fEffectStage; | 282 fSavedEffectStage = codeStage->fEffectStage; |
283 | 283 |
284 if (NULL == newStage) { | 284 if (NULL == newStage) { |
285 codeStage->fCurrentIndex = -1; | 285 codeStage->fCurrentIndex = -1; |
286 } else { | 286 } else { |
287 codeStage->fCurrentIndex = codeStage->fNextIndex++; | 287 codeStage->fCurrentIndex = codeStage->fNextIndex++; |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 int effectCnt, | 466 int effectCnt, |
467 GrGLSLExpr4* inOutFSColor) SK_OVERRIDE; | 467 GrGLSLExpr4* inOutFSColor) SK_OVERRIDE; |
468 | 468 |
469 private: | 469 private: |
470 int fNumTexCoordSets; | 470 int fNumTexCoordSets; |
471 | 471 |
472 typedef GrGLShaderBuilder INHERITED; | 472 typedef GrGLShaderBuilder INHERITED; |
473 }; | 473 }; |
474 | 474 |
475 #endif | 475 #endif |
OLD | NEW |