Try r5428 again with fix
git-svn-id: http://skia.googlecode.com/svn/trunk@5431 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/gl/GrGLShaderBuilder.cpp b/src/gpu/gl/GrGLShaderBuilder.cpp
index b10f4e6..17c0083 100644
--- a/src/gpu/gl/GrGLShaderBuilder.cpp
+++ b/src/gpu/gl/GrGLShaderBuilder.cpp
@@ -83,19 +83,6 @@
, fTexCoordVaryingType(kVoid_GrSLType) {
}
-void GrGLShaderBuilder::computeSwizzle(uint32_t configFlags) {
- fSwizzle = "";
- if (configFlags & GrGLProgram::StageDesc::kSmearAlpha_InConfigFlag) {
- GrAssert(!(configFlags &
- GrGLProgram::StageDesc::kSmearRed_InConfigFlag));
- fSwizzle = ".aaaa";
- } else if (configFlags & GrGLProgram::StageDesc::kSmearRed_InConfigFlag) {
- GrAssert(!(configFlags &
- GrGLProgram::StageDesc::kSmearAlpha_InConfigFlag));
- fSwizzle = ".rrrr";
- }
-}
-
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
// projective texturing and always give the stage 2D coords. This will be fixed when custom
@@ -126,14 +113,17 @@
const GrGLShaderBuilder::TextureSampler& sampler,
const char* coordName,
GrSLType varyingType) const {
+ GrAssert(NULL != sampler.textureAccess());
+ SkString swizzle = build_swizzle_string(*sampler.textureAccess(), fContext.caps());
+
if (NULL == coordName) {
coordName = fDefaultTexCoordsName.c_str();
varyingType = kVec2f_GrSLType;
}
- out->appendf("%s(%s, %s)",
+ out->appendf("%s(%s, %s)%s",
sample_function_name(varyingType),
this->getUniformCStr(sampler.fSamplerUniform),
- coordName);
+ coordName, swizzle.c_str());
}
void GrGLShaderBuilder::appendTextureLookupAndModulate(
@@ -145,22 +135,9 @@
GrAssert(NULL != out);
SkString lookup;
this->appendTextureLookup(&lookup, sampler, coordName, varyingType);
- lookup.append(fSwizzle.c_str());
GrGLSLModulate4f(out, modulation, lookup.c_str());
}
-void GrGLShaderBuilder::emitCustomTextureLookup(const GrGLShaderBuilder::TextureSampler& sampler,
- const char* coordName,
- GrSLType varyingType) {
- GrAssert(NULL != sampler.textureAccess());
- SkString swizzle = build_swizzle_string(*sampler.textureAccess(), fContext.caps());
-
- fFSCode.appendf("%s( %s, %s)%s;\n",
- sample_function_name(varyingType),
- this->getUniformCStr(sampler.fSamplerUniform),
- coordName, swizzle.c_str());
-}
-
GrCustomStage::StageKey GrGLShaderBuilder::KeyForTextureAccess(const GrTextureAccess& access,
const GrGLCaps& caps) {
GrCustomStage::StageKey key = 0;