| Index: src/gpu/gl/GrGLShaderBuilder.cpp
|
| diff --git a/src/gpu/gl/GrGLShaderBuilder.cpp b/src/gpu/gl/GrGLShaderBuilder.cpp
|
| index 40ca0f2567fadddc842ec34376005104e83c66bc..40a0888362cc900c42ef15840e6447755a8ca749 100644
|
| --- a/src/gpu/gl/GrGLShaderBuilder.cpp
|
| +++ b/src/gpu/gl/GrGLShaderBuilder.cpp
|
| @@ -289,13 +289,13 @@ void GrGLShaderBuilder::fsAppendTextureLookup(const GrGLShaderBuilder::TextureSa
|
| }
|
|
|
| void GrGLShaderBuilder::fsAppendTextureLookupAndModulate(
|
| - const char* modulation,
|
| + const GrGLSLExpr4& modulation,
|
| const GrGLShaderBuilder::TextureSampler& sampler,
|
| const char* coordName,
|
| GrSLType varyingType) {
|
| SkString lookup;
|
| this->appendTextureLookup(&lookup, sampler, coordName, varyingType);
|
| - fFSCode.append((GrGLSLExpr4(modulation) * GrGLSLExpr4(lookup)).c_str());
|
| + fFSCode.append((modulation * GrGLSLExpr4(lookup)).c_str());
|
| }
|
|
|
| GrGLShaderBuilder::DstReadKey GrGLShaderBuilder::KeyForDstRead(const GrTexture* dstCopy,
|
| @@ -516,45 +516,24 @@ void GrGLShaderBuilder::createAndEmitEffects(GrGLProgramEffectsBuilder* programE
|
| const EffectKey effectKeys[],
|
| int effectCnt,
|
| GrGLSLExpr4* fsInOutColor) {
|
| - bool effectEmitted = false;
|
| -
|
| - GrGLSLExpr4 inColor = *fsInOutColor;
|
| - GrGLSLExpr4 outColor;
|
| -
|
| for (int e = 0; e < effectCnt; ++e) {
|
| SkASSERT(NULL != effectStages[e] && NULL != effectStages[e]->getEffect());
|
| const GrEffectStage& stage = *effectStages[e];
|
|
|
| CodeStage::AutoStageRestore csar(&fCodeStage, &stage);
|
|
|
| - if (inColor.isZeros()) {
|
| - SkString inColorName;
|
| -
|
| - // Effects have no way to communicate zeros, they treat an empty string as ones.
|
| - this->nameVariable(&inColorName, '\0', "input");
|
| - this->fsCodeAppendf("\tvec4 %s = %s;\n", inColorName.c_str(), inColor.c_str());
|
| - inColor = inColorName;
|
| - }
|
| -
|
| // create var to hold stage result
|
| SkString outColorName;
|
| this->nameVariable(&outColorName, '\0', "output");
|
| this->fsCodeAppendf("\tvec4 %s;\n", outColorName.c_str());
|
| - outColor = outColorName;
|
| -
|
|
|
| programEffectsBuilder->emitEffect(stage,
|
| effectKeys[e],
|
| - outColor.c_str(),
|
| - inColor.isOnes() ? NULL : inColor.c_str(),
|
| + outColorName.c_str(),
|
| + *fsInOutColor,
|
| fCodeStage.stageIndex());
|
|
|
| - inColor = outColor;
|
| - effectEmitted = true;
|
| - }
|
| -
|
| - if (effectEmitted) {
|
| - *fsInOutColor = outColor;
|
| + *fsInOutColor = GrGLSLExpr4(outColorName);
|
| }
|
| }
|
|
|
| @@ -747,7 +726,7 @@ GrGLFullShaderBuilder::GrGLFullShaderBuilder(GrGpuGL* gpu,
|
| const char *vsName, *fsName;
|
| this->addVarying(kVec4f_GrSLType, "Color", &vsName, &fsName);
|
| this->vsCodeAppendf("\t%s = %s;\n", vsName, color_attribute_name());
|
| - this->setInputColor(fsName);
|
| + this->setInputColor(GrGLSLExpr4(fsName));
|
| }
|
|
|
| if (GrGLProgramDesc::kAttribute_ColorInput == header.fCoverageInput) {
|
| @@ -755,7 +734,7 @@ GrGLFullShaderBuilder::GrGLFullShaderBuilder(GrGpuGL* gpu,
|
| const char *vsName, *fsName;
|
| this->addVarying(kVec4f_GrSLType, "Coverage", &vsName, &fsName);
|
| this->vsCodeAppendf("\t%s = %s;\n", vsName, coverage_attribute_name());
|
| - this->setInputCoverage(fsName);
|
| + this->setInputCoverage(GrGLSLExpr4(fsName));
|
| }
|
| }
|
|
|
|
|