diff options
author | 2011-02-02 22:42:20 +0000 | |
---|---|---|
committer | 2011-02-02 22:42:20 +0000 | |
commit | d16983b31f5750c28f0b493f3639d407f1b94610 (patch) | |
tree | ae294eb768a9de9743a90a3ff2ce3b96dc1616dc /gpu/src/GrGpuGLShaders2.cpp | |
parent | 4333323006ac6ef472e011b8ea8f0bb303a0f21f (diff) |
Make aggressive shader opts an option in GrUserConfig.h. Currently just controls whether color=white optimization is applied (eliminates reading color varying and modulation by color). This was already a compile time option just not exposed through user config.
git-svn-id: http://skia.googlecode.com/svn/trunk@754 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gpu/src/GrGpuGLShaders2.cpp')
-rw-r--r-- | gpu/src/GrGpuGLShaders2.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/gpu/src/GrGpuGLShaders2.cpp b/gpu/src/GrGpuGLShaders2.cpp index 82d7d272db..9aa327ae54 100644 --- a/gpu/src/GrGpuGLShaders2.cpp +++ b/gpu/src/GrGpuGLShaders2.cpp @@ -27,8 +27,6 @@ #define ATTRIBUTE_MATRIX 0 -#define SKIP_COLOR_MODULATE_OPT 0 - #define PRINT_SHADERS 0 #define SKIP_CACHE_CHECK true @@ -985,23 +983,23 @@ void GrGpuGLShaders2::getProgramDesc(PrimitiveType primType, ProgramDesc* desc) // Must initialize all fields or cache will have false negatives! desc->fVertexLayout = fGeometrySrc.fVertexLayout; + + desc->fOptFlags = 0; + if (kPoints_PrimitiveType != primType) { + desc->fOptFlags |= ProgramDesc::kNotPoints_OptFlagBit; + } +#if GR_AGGRESSIVE_SHADER_OPTS
+ if (!(desc->fVertexLayout & kColor_VertexLayoutBit) &&
+ (0xffffffff == fCurrDrawState.fColor)) {
+ desc->fOptFlags |= ProgramDesc::kVertexColorAllOnes_OptFlagBit;
+ }
+#endif + for (int s = 0; s < kNumStages; ++s) { StageDesc& stage = desc->fStages[s]; stage.fEnabled = VertexUsesStage(s, fGeometrySrc.fVertexLayout); - if (primType != kPoints_PrimitiveType) { - desc->fOptFlags = ProgramDesc::kNotPoints_OptFlagBit; - } else { - desc->fOptFlags = 0; - } - #if SKIP_COLOR_MODULATE_OPT - if (!(desc->fVertexLayout & kColor_VertexLayoutBit) && - (0xffffffff == fCurrDrawState.fColor)) { - desc->fOptFlags |= ProgramDesc::kVertexColorAllOnes_OptFlagBit; - } - #endif - if (stage.fEnabled) { GrGLTexture* texture = (GrGLTexture*) fCurrDrawState.fTextures[s]; GrAssert(NULL != texture); |