GrCustomStage Renaming Part 3

Rename all things *CUSTOM_STAGE*, customStage*, and other miscellany

R=robertphillips@google.com
Review URL: https://codereview.appspot.com/6769048

git-svn-id: http://skia.googlecode.com/svn/trunk@6081 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index 08e58e8..5549e58 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -53,8 +53,8 @@
 
 GrGLProgram* GrGLProgram::Create(const GrGLContextInfo& gl,
                                  const Desc& desc,
-                                 const GrEffect** customStages) {
-    GrGLProgram* program = SkNEW_ARGS(GrGLProgram, (gl, desc, customStages));
+                                 const GrEffect** effects) {
+    GrGLProgram* program = SkNEW_ARGS(GrGLProgram, (gl, desc, effects));
     if (!program->succeeded()) {
         delete program;
         program = NULL;
@@ -64,7 +64,7 @@
 
 GrGLProgram::GrGLProgram(const GrGLContextInfo& gl,
                          const Desc& desc,
-                         const GrEffect** customStages)
+                         const GrEffect** effects)
 : fContextInfo(gl)
 , fUniformManager(gl) {
     fDesc = desc;
@@ -86,7 +86,7 @@
         fTextureOrientation[s] = GrGLTexture::kBottomUp_Orientation;
     }
 
-    this->genProgram(customStages);
+    this->genProgram(effects);
 }
 
 GrGLProgram::~GrGLProgram() {
@@ -500,7 +500,7 @@
     return true;
 }
 
-bool GrGLProgram::genProgram(const GrEffect** customStages) {
+bool GrGLProgram::genProgram(const GrEffect** effects) {
     GrAssert(0 == fProgramID);
 
     GrGLShaderBuilder builder(fContextInfo, fUniformManager);
@@ -624,7 +624,7 @@
                 }
 
                 builder.setCurrentStage(s);
-                fProgramStage[s] = GenStageCode(customStages[s],
+                fProgramStage[s] = GenStageCode(effects[s],
                                                 fDesc.fStages[s],
                                                 &fUniforms.fStages[s],
                                                 inColor.size() ? inColor.c_str() : NULL,
@@ -729,7 +729,7 @@
                         inCoverage.append("4");
                     }
                     builder.setCurrentStage(s);
-                    fProgramStage[s] = GenStageCode(customStages[s],
+                    fProgramStage[s] = GenStageCode(effects[s],
                                                     fDesc.fStages[s],
                                                     &fUniforms.fStages[s],
                                                     inCoverage.size() ? inCoverage.c_str() : NULL,
@@ -880,7 +880,7 @@
     for (int s = 0; s < GrDrawState::kNumStages; ++s) {
         int count = fUniforms.fStages[s].fSamplerUniforms.count();
         // FIXME: We're still always reserving one texture per stage. After GrTextureParams are
-        // expressed by the custom stage rather than the GrSamplerState we can move texture binding
+        // expressed by the effect rather than the GrSamplerState we can move texture binding
         // into GrGLProgram and it should be easier to fix this.
         GrAssert(count <= 1);
         for (int t = 0; t < count; ++t) {
diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h
index c9afc2b..f6760a9 100644
--- a/src/gpu/gl/GrGLProgram.h
+++ b/src/gpu/gl/GrGLProgram.h
@@ -43,7 +43,7 @@
 
     static GrGLProgram* Create(const GrGLContextInfo& gl,
                                const Desc& desc,
-                               const GrEffect** customStages);
+                               const GrEffect** effects);
 
     virtual ~GrGLProgram();
 
@@ -164,14 +164,14 @@
 
     GrGLProgram(const GrGLContextInfo& gl,
                 const Desc& desc,
-                const GrEffect** customStages);
+                const GrEffect** effects);
 
     bool succeeded() const { return 0 != fProgramID; }
 
     /**
      *  This is the heavy initialization routine for building a GLProgram.
      */
-    bool genProgram(const GrEffect** customStages);
+    bool genProgram(const GrEffect** effects);
 
     void genInputColor(GrGLShaderBuilder* builder, SkString* inColor);
 
diff --git a/src/gpu/gl/GrGLProgramStage.h b/src/gpu/gl/GrGLProgramStage.h
index 3f8afe4..37d0b03 100644
--- a/src/gpu/gl/GrGLProgramStage.h
+++ b/src/gpu/gl/GrGLProgramStage.h
@@ -50,7 +50,7 @@
         stages.
 
         @param builder      Interface used to emit code in the shaders.
-        @param stage        The custom stage that generated this program stage.
+        @param effect       The effect that generated this program stage.
         @param key          The key that was computed by StageKey() from the generating GrEffect.
         @param vertexCoords A vec2 of texture coordinates in the VS, which may be altered. This will
                             be removed soon and stages will be responsible for computing their own
@@ -61,14 +61,13 @@
                             NULL in which case the implied input is solid white (all ones).
                             TODO: Better system for communicating optimization info (e.g. input
                             color is solid white, trans black, known to be opaque, etc.) that allows
-                            the custom stage to communicate back similar known info about its
-                            output.
+                            the effect to communicate back similar known info about its output.
         @param samplers     One entry for each GrTextureAccess of the GrEffect that generated the
                             GrGLProgramStage. These can be passed to the builder to emit texture
                             reads in the generated code.
         */
     virtual void emitCode(GrGLShaderBuilder* builder,
-                          const GrEffect& stage,
+                          const GrEffect& effect,
                           StageKey key,
                           const char* vertexCoords,
                           const char* outputColor,
diff --git a/src/gpu/gl/GrGLSL.h b/src/gpu/gl/GrGLSL.h
index ec34eea..af0da29 100644
--- a/src/gpu/gl/GrGLSL.h
+++ b/src/gpu/gl/GrGLSL.h
@@ -153,7 +153,7 @@
  * mulFactor may be either "" or NULL. In this case either nothing will be appended (kOnes) or an
  * assignment of vec(0,0,0,0) will be appended (kZeros). The assignment is prepended by tabCnt tabs.
  * A semicolon and newline are added after the assignment. (TODO: Remove tabCnt when we auto-insert
- * tabs to custom stage-generated lines.) If a zeros vec is assigned then the return value is
+ * tabs to GrGLProgramStage-generated lines.) If a zeros vec is assigned then the return value is
  * kZeros, otherwise kNone.
  */
 GrSLConstantVec GrGLSLMulVarBy4f(SkString* outAppend,
diff --git a/src/gpu/gl/GrGLShaderBuilder.cpp b/src/gpu/gl/GrGLShaderBuilder.cpp
index f11a8d9..217b874 100644
--- a/src/gpu/gl/GrGLShaderBuilder.cpp
+++ b/src/gpu/gl/GrGLShaderBuilder.cpp
@@ -99,7 +99,7 @@
 }
 
 void GrGLShaderBuilder::setupTextureAccess(const char* varyingFSName, GrSLType varyingType) {
-    // FIXME: We don't know how the custom stage will manipulate the coords. So we give up on using
+    // FIXME: We don't know how the effect will manipulate the coords. So we give up on using
     // projective texturing and always give the stage 2D coords. This will be fixed when custom
     // stages are responsible for setting up their own tex coords / tex matrices.
     switch (varyingType) {
diff --git a/src/gpu/gl/GrGLShaderBuilder.h b/src/gpu/gl/GrGLShaderBuilder.h
index 0b5eb17..cb38247 100644
--- a/src/gpu/gl/GrGLShaderBuilder.h
+++ b/src/gpu/gl/GrGLShaderBuilder.h
@@ -173,13 +173,13 @@
     void getShader(ShaderType, SkString*) const;
 
     /**
-     * TODO: Make this do all the compiling, linking, etc. Hide from the custom stages
+     * TODO: Make this do all the compiling, linking, etc. Hide from the GrEffects
      */
     void finished(GrGLuint programID);
 
     /**
      * Sets the current stage (used to make variable names unique).
-     * TODO: Hide from the custom stages
+     * TODO: Hide from the GrEffects
      */
     void setCurrentStage(int stage) { fCurrentStage = stage; }
     void setNonStage() { fCurrentStage = kNonStageIdx; }
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index 858e938..7a58c53 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -2018,12 +2018,12 @@
 
 void GrGpuGL::flushBoundTextureAndParams(int stage) {
     GrDrawState* drawState = this->drawState();
-    // FIXME: Assuming at most one texture per custom stage
-    const GrEffect* customStage = drawState->sampler(stage)->getEffect();
-    if (customStage->numTextures() > 0) {
-        GrGLTexture* nextTexture =  static_cast<GrGLTexture*>(customStage->texture(0));
+    // FIXME: Assuming at most one texture per effect
+    const GrEffect* effect = drawState->sampler(stage)->getEffect();
+    if (effect->numTextures() > 0) {
+        GrGLTexture* nextTexture =  static_cast<GrGLTexture*>(effect->texture(0));
         if (NULL != nextTexture) {
-            const GrTextureParams& texParams = customStage->textureAccess(0).getParams();
+            const GrTextureParams& texParams = effect->textureAccess(0).getParams();
             this->flushBoundTextureAndParams(stage, texParams, nextTexture);
         }
     }
diff --git a/src/gpu/gl/GrGpuGL.h b/src/gpu/gl/GrGpuGL.h
index eab0a77..0cd7eb5 100644
--- a/src/gpu/gl/GrGpuGL.h
+++ b/src/gpu/gl/GrGpuGL.h
@@ -240,7 +240,7 @@
     void buildProgram(bool isPoints,
                       BlendOptFlags blendOpts,
                       GrBlendCoeff dstCoeff,
-                      const GrEffect** customStages,
+                      const GrEffect** effects,
                       ProgramDesc* desc);
 
     // Inits GrDrawTarget::Caps, subclass may enable additional caps.
diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp
index b0656b2..9f78aa4 100644
--- a/src/gpu/gl/GrGpuGL_program.cpp
+++ b/src/gpu/gl/GrGpuGL_program.cpp
@@ -198,7 +198,7 @@
 void GrGpuGL::flushTextureMatrix(int s) {
     const GrDrawState& drawState = this->getDrawState();
 
-    // FIXME: Still assuming only a single texture per custom stage
+    // FIXME: Still assuming only a single texture per effect
     const GrEffect* stage = drawState.getSampler(s).getEffect();
     if (0 == stage->numTextures()) {
         return;
@@ -350,11 +350,11 @@
             return false;
         }
 
-        const GrEffect* customStages [GrDrawState::kNumStages];
+        const GrEffect* effects[GrDrawState::kNumStages];
         GrGLProgram::Desc desc;
-        this->buildProgram(kDrawPoints_DrawType == type, blendOpts, dstCoeff, customStages, &desc);
+        this->buildProgram(kDrawPoints_DrawType == type, blendOpts, dstCoeff, effects, &desc);
 
-        fCurrentProgram.reset(fProgramCache->getProgram(desc, customStages));
+        fCurrentProgram.reset(fProgramCache->getProgram(desc, effects));
         if (NULL == fCurrentProgram.get()) {
             GrAssert(!"Failed to create program!");
             return false;
@@ -565,19 +565,19 @@
 
 namespace {
 
-void setup_custom_stage(GrGLProgram::Desc::StageDesc* stage,
-                        const GrSamplerState& sampler,
-                        const GrGLCaps& caps,
-                        const GrEffect** customStages,
-                        GrGLProgram* program, int index) {
-    const GrEffect* customStage = sampler.getEffect();
-    if (customStage) {
-        const GrProgramStageFactory& factory = customStage->getFactory();
-        stage->fCustomStageKey = factory.glStageKey(*customStage, caps);
-        customStages[index] = customStage;
+void setup_effect(GrGLProgram::Desc::StageDesc* stage,
+                  const GrSamplerState& sampler,
+                  const GrGLCaps& caps,
+                  const GrEffect** effects,
+                  GrGLProgram* program, int index) {
+    const GrEffect* effect = sampler.getEffect();
+    if (effect) {
+        const GrProgramStageFactory& factory = effect->getFactory();
+        stage->fCustomStageKey = factory.glStageKey(*effect, caps);
+        effects[index] = effect;
     } else {
         stage->fCustomStageKey = 0;
-        customStages[index] = NULL;
+        effects[index] = NULL;
     }
 }
 
@@ -586,7 +586,7 @@
 void GrGpuGL::buildProgram(bool isPoints,
                            BlendOptFlags blendOpts,
                            GrBlendCoeff dstCoeff,
-                           const GrEffect** customStages,
+                           const GrEffect** effects,
                            ProgramDesc* desc) {
     const GrDrawState& drawState = this->getDrawState();
 
@@ -674,12 +674,11 @@
         if (!skip && stage.isEnabled()) {
             lastEnabledStage = s;
             const GrSamplerState& sampler = drawState.getSampler(s);
-            // FIXME: Still assuming one texture per custom stage
-            const GrEffect* customStage = drawState.getSampler(s).getEffect();
+            // FIXME: Still assuming one texture per effect
+            const GrEffect* effect = drawState.getSampler(s).getEffect();
 
-            if (customStage->numTextures() > 0) {
-                const GrGLTexture* texture =
-                    static_cast<const GrGLTexture*>(customStage->texture(0));
+            if (effect->numTextures() > 0) {
+                const GrGLTexture* texture = static_cast<const GrGLTexture*>(effect->texture(0));
                 GrMatrix samplerMatrix;
                 sampler.getTotalMatrix(&samplerMatrix);
                 if (NULL != texture) {
@@ -690,16 +689,15 @@
                 }
             } else {
                 // Set identity to do the minimal amount of extra work for the no texture case.
-                // This will go away when custom stages manage their own texture matrix.
+                // This will go away when effects manage their own texture matrix.
                 stage.fOptFlags |= StageDesc::kIdentityMatrix_OptFlagBit;
             }
-            setup_custom_stage(&stage, sampler, this->glCaps(), customStages,
-                               fCurrentProgram.get(), s);
+            setup_effect(&stage, sampler, this->glCaps(), effects, fCurrentProgram.get(), s);
 
         } else {
             stage.fOptFlags         = 0;
             stage.fCustomStageKey   = 0;
-            customStages[s] = NULL;
+            effects[s] = NULL;
         }
     }