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 |
11 #include "GrAllocator.h" | 11 #include "GrAllocator.h" |
12 #include "GrBackendEffectFactory.h" | 12 #include "GrBackendEffectFactory.h" |
13 #include "GrColor.h" | 13 #include "GrColor.h" |
14 #include "GrEffect.h" | 14 #include "GrEffect.h" |
| 15 #include "SkTypes.h" |
15 #include "gl/GrGLSL.h" | 16 #include "gl/GrGLSL.h" |
16 #include "gl/GrGLUniformManager.h" | 17 #include "gl/GrGLUniformManager.h" |
17 | 18 |
18 #include <stdarg.h> | 19 #include <stdarg.h> |
19 | 20 |
20 class GrGLContextInfo; | 21 class GrGLContextInfo; |
21 class GrEffectStage; | 22 class GrEffectStage; |
22 class GrGLProgramDesc; | 23 class GrGLProgramDesc; |
23 | 24 |
24 /** | 25 /** |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 const GrGLContextInfo& ctxInfo() const { return fCtxInfo; } | 380 const GrGLContextInfo& ctxInfo() const { return fCtxInfo; } |
380 | 381 |
381 private: | 382 private: |
382 void appendDecls(const VarArray&, SkString*) const; | 383 void appendDecls(const VarArray&, SkString*) const; |
383 void appendUniformDecls(ShaderVisibility, SkString*) const; | 384 void appendUniformDecls(ShaderVisibility, SkString*) const; |
384 | 385 |
385 typedef GrGLUniformManager::BuilderUniform BuilderUniform; | 386 typedef GrGLUniformManager::BuilderUniform BuilderUniform; |
386 GrGLUniformManager::BuilderUniformArray fUniforms; | 387 GrGLUniformManager::BuilderUniformArray fUniforms; |
387 | 388 |
388 private: | 389 private: |
389 class CodeStage : GrNoncopyable { | 390 class CodeStage : public SkNoncopyable { |
390 public: | 391 public: |
391 CodeStage() : fNextIndex(0), fCurrentIndex(-1), fEffect(NULL) {} | 392 CodeStage() : fNextIndex(0), fCurrentIndex(-1), fEffect(NULL) {} |
392 | 393 |
393 bool inStageCode() const { | 394 bool inStageCode() const { |
394 this->validate(); | 395 this->validate(); |
395 return NULL != fEffect; | 396 return NULL != fEffect; |
396 } | 397 } |
397 | 398 |
398 const GrEffectRef* effect() const { | 399 const GrEffectRef* effect() const { |
399 this->validate(); | 400 this->validate(); |
400 return fEffect; | 401 return fEffect; |
401 } | 402 } |
402 | 403 |
403 int stageIndex() const { | 404 int stageIndex() const { |
404 this->validate(); | 405 this->validate(); |
405 return fCurrentIndex; | 406 return fCurrentIndex; |
406 } | 407 } |
407 | 408 |
408 class AutoStageRestore : GrNoncopyable { | 409 class AutoStageRestore : public SkNoncopyable { |
409 public: | 410 public: |
410 AutoStageRestore(CodeStage* codeStage, const GrEffectRef* effect) { | 411 AutoStageRestore(CodeStage* codeStage, const GrEffectRef* effect) { |
411 SkASSERT(NULL != codeStage); | 412 SkASSERT(NULL != codeStage); |
412 fSavedIndex = codeStage->fCurrentIndex; | 413 fSavedIndex = codeStage->fCurrentIndex; |
413 fSavedEffect = codeStage->fEffect; | 414 fSavedEffect = codeStage->fEffect; |
414 | 415 |
415 if (NULL == effect) { | 416 if (NULL == effect) { |
416 codeStage->fCurrentIndex = -1; | 417 codeStage->fCurrentIndex = -1; |
417 } else { | 418 } else { |
418 codeStage->fCurrentIndex = codeStage->fNextIndex++; | 419 codeStage->fCurrentIndex = codeStage->fNextIndex++; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 GrGLUniformManager::UniformHandle fRTHeightUniform; | 487 GrGLUniformManager::UniformHandle fRTHeightUniform; |
487 GrGLUniformManager::UniformHandle fDstCopyTopLeftUniform; | 488 GrGLUniformManager::UniformHandle fDstCopyTopLeftUniform; |
488 GrGLUniformManager::UniformHandle fDstCopyScaleUniform; | 489 GrGLUniformManager::UniformHandle fDstCopyScaleUniform; |
489 | 490 |
490 bool fTopLeftFragPosRead; | 491 bool fTopLeftFragPosRead; |
491 | 492 |
492 SkAutoTDelete<VertexBuilder> fVertexBuilder; | 493 SkAutoTDelete<VertexBuilder> fVertexBuilder; |
493 }; | 494 }; |
494 | 495 |
495 #endif | 496 #endif |
OLD | NEW |