Removed the "any" command from the displacement glsl shader.
WebKit's version of Mesa's compiler seems to crash on the "any" command even though it's a GLSL 1.1 command.
Review URL: https://codereview.chromium.org/12413030
git-svn-id: http://skia.googlecode.com/svn/trunk@8300 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index 13f93a6..4d2e2dd 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -401,6 +401,8 @@
const char* outputColor,
const char* inputColor,
const TextureSamplerArray& samplers) {
+ sk_ignore_unused_variable(inputColor);
+
fScaleUni = builder->addUniform(GrGLShaderBuilder::kFragment_ShaderType,
kVec2f_GrSLType, "Scale");
const char* scaleUni = builder->getUniformCStr(fScaleUni);
@@ -414,6 +416,7 @@
const char* dColor = "dColor";
const char* cCoords = "cCoords";
+ const char* outOfBounds = "outOfBounds";
const char* nearZero = "1e-6"; // Since 6.10352e−5 is the smallest half float, use
// a number smaller than that to approximate 0, but
// leave room for 32-bit float GPU rounding errors.
@@ -472,8 +475,9 @@
// FIXME : This can be achieved with a "clamp to border" texture repeat mode and
// a 0 border color instead of computing if cCoords is out of bounds here.
builder->fsCodeAppendf(
- "%s = any(greaterThan(vec4(vec2(0.0), %s), vec4(%s, vec2(1.0)))) ? vec4(0.0) : ",
- outputColor, cCoords, cCoords);
+ "bool %s = (%s.x < 0.0) || (%s.y < 0.0) || (%s.x > 1.0) || (%s.y > 1.0);\t\t",
+ outOfBounds, cCoords, cCoords, cCoords, cCoords);
+ builder->fsCodeAppendf("%s = %s ? vec4(0.0) : ", outputColor, outOfBounds);
builder->appendTextureLookup(GrGLShaderBuilder::kFragment_ShaderType,
samplers[1],
cCoords,