Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1246)

Unified Diff: src/effects/SkDisplacementMapEffect.cpp

Issue 12413030: Removed the "any" command from the displacement glsl shader. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkDisplacementMapEffect.cpp
===================================================================
--- src/effects/SkDisplacementMapEffect.cpp (revision 8291)
+++ src/effects/SkDisplacementMapEffect.cpp (working copy)
@@ -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,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698