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
diff --git a/gpu/src/GrGpuGLShaders2.cpp b/gpu/src/GrGpuGLShaders2.cpp
index 82d7d27..9aa327a 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 @@
// 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);