aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2015-06-30 09:19:14 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-06-30 09:19:15 -0700
commitffe6ebb8a8fd93091e2f5ca3fc9d8cd21b9c92df (patch)
tree10817865eea3ead32ac693eb9cf7755a5cbf32ab /src/gpu/effects
parent8f74c160c31b11155300f0a7b79cb8906775c185 (diff)
Fix blur bug on Andreno 430 with bool cast to float
Diffstat (limited to 'src/gpu/effects')
-rw-r--r--src/gpu/effects/GrConvolutionEffect.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp
index 72640824d2..0dfc3bf54e 100644
--- a/src/gpu/effects/GrConvolutionEffect.cpp
+++ b/src/gpu/effects/GrConvolutionEffect.cpp
@@ -85,15 +85,22 @@ void GrGLConvolutionEffect::emitCode(GrGLFPBuilder* builder,
SkString kernelIndex;
index.appendS32(i);
kernel.appendArrayAccess(index.c_str(), &kernelIndex);
- fsBuilder->codeAppendf("\t\t%s += ", outputColor);
- fsBuilder->appendTextureLookup(samplers[0], "coord");
+
if (this->useBounds()) {
+ // We used to compute a bool indicating whether we're in bounds or not, cast it to a
+ // float, and then mul weight*texture_sample by the float. However, the Adreno 430 seems
+ // to have a bug that caused corruption.
const char* bounds = builder->getUniformCStr(fBoundsUni);
const char* component = this->direction() == Gr1DKernelEffect::kY_Direction ? "y" : "x";
- fsBuilder->codeAppendf(" * float(coord.%s >= %s.x && coord.%s <= %s.y)",
+ fsBuilder->codeAppendf("if (coord.%s >= %s.x && coord.%s <= %s.y) {",
component, bounds, component, bounds);
}
+ fsBuilder->codeAppendf("\t\t%s += ", outputColor);
+ fsBuilder->appendTextureLookup(samplers[0], "coord");
fsBuilder->codeAppendf(" * %s;\n", kernelIndex.c_str());
+ if (this->useBounds()) {
+ fsBuilder->codeAppend("}");
+ }
fsBuilder->codeAppendf("\t\tcoord += %s;\n", imgInc);
}