Wrap all GrCustomStage textures in GrTextureAccess, remove StageDesc::fInConfigFlags

Review URL: https://codereview.appspot.com/6494114



git-svn-id: http://skia.googlecode.com/svn/trunk@5485 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index dfe5277..2703110 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -931,8 +931,6 @@
 
     GrGLProgramStage* glStage = stage->getFactory().createGLInstance(*stage);
 
-    GrAssert((desc.fInConfigFlags & StageDesc::kInConfigBitMask) == desc.fInConfigFlags);
-
     /// Vertex Shader Stuff
 
     // decide whether we need a matrix to transform texture coords and whether the varying needs a
@@ -964,30 +962,11 @@
 
     int numTextures = stage->numTextures();
     SkSTArray<8, GrGLShaderBuilder::TextureSampler> textureSamplers;
-    // temporary until we force custom stages to provide their own texture access
-    SkSTArray<8, bool, true> deleteTextureAccess;
 
     textureSamplers.push_back_n(numTextures);
-    deleteTextureAccess.push_back_n(numTextures);
 
     for (int i = 0; i < numTextures; ++i) {
-        // Right now we don't require a texture access for every texture. This will change soon.
-        const GrTextureAccess* access = stage->textureAccess(i);
-        GrAssert(NULL != stage->texture(i));
-        if (NULL == access) {
-            SkString swizzle;
-            if (desc.fInConfigFlags & StageDesc::kSmearAlpha_InConfigFlag) {
-                swizzle.printf("aaaa");
-            } else {
-                swizzle.printf("rgba");
-            }
-            access = SkNEW_ARGS(GrTextureAccess, (stage->texture(i), swizzle));
-            deleteTextureAccess[i] = true;
-        } else {
-            GrAssert(access->getTexture() == stage->texture(i));
-            deleteTextureAccess[i] = false;
-        }
-        textureSamplers[i].init(builder, access);
+        textureSamplers[i].init(builder, &stage->textureAccess(i));
         uniforms->fSamplerUniforms.push_back(textureSamplers[i].fSamplerUniform);
     }
 
@@ -1010,10 +989,5 @@
     glStage->emitFS(builder, fsOutColor, fsInColor, textureSamplers);
     builder->fFSCode.appendf("\t}\n");
 
-    for (int i = 0; i < numTextures; ++i) {
-        if (deleteTextureAccess[i]) {
-            SkDELETE(textureSamplers[i].textureAccess());
-        }
-    }
     return glStage;
 }