diff options
author | 2014-06-20 07:25:14 -0700 | |
---|---|---|
committer | 2014-06-20 07:25:14 -0700 | |
commit | 160a52ba217012ed73c240f6d67b3bbf2b4879d6 (patch) | |
tree | 38419846c9e777c42093739a4eb90b0a0fd4d97f /src/gpu/effects | |
parent | 6b8f1ba1ef71a762e961c3a8bc8b344c88990a04 (diff) |
Stop referencing gl_FragCoord z and w components.
This fixes an Adreno driver bug where GL programs fail to link if the FS refers to these components of gl_FragCoord.
R=jvanverth@google.com
Author: bsalomon@google.com
Review URL: https://codereview.chromium.org/345083002
Diffstat (limited to 'src/gpu/effects')
-rw-r--r-- | src/gpu/effects/GrDitherEffect.cpp | 2 | ||||
-rw-r--r-- | src/gpu/effects/GrOvalEffect.cpp | 6 | ||||
-rw-r--r-- | src/gpu/effects/GrRRectEffect.cpp | 8 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/gpu/effects/GrDitherEffect.cpp b/src/gpu/effects/GrDitherEffect.cpp index 7409e5ff71..e82b565b5e 100644 --- a/src/gpu/effects/GrDitherEffect.cpp +++ b/src/gpu/effects/GrDitherEffect.cpp @@ -102,7 +102,7 @@ void GLDitherEffect::emitCode(GrGLShaderBuilder* builder, // For each channel c, add the random offset to the pixel to either bump // it up or let it remain constant during quantization. builder->fsCodeAppendf("\t\tfloat r = " - "fract(sin(dot(%s.xy ,vec2(12.9898,78.233))) * 43758.5453);\n", + "fract(sin(dot(%s ,vec2(12.9898,78.233))) * 43758.5453);\n", builder->fragmentPosition()); builder->fsCodeAppendf("\t\t%s = (1.0/255.0) * vec4(r, r, r, r) + %s;\n", outputColor, GrGLSLExpr4(inputColor).c_str()); diff --git a/src/gpu/effects/GrOvalEffect.cpp b/src/gpu/effects/GrOvalEffect.cpp index f2ee27880f..1297331d78 100644 --- a/src/gpu/effects/GrOvalEffect.cpp +++ b/src/gpu/effects/GrOvalEffect.cpp @@ -147,10 +147,10 @@ void GLCircleEffect::emitCode(GrGLShaderBuilder* builder, SkASSERT(kHairlineAA_GrEffectEdgeType != ce.getEdgeType()); if (GrEffectEdgeTypeIsInverseFill(ce.getEdgeType())) { - builder->fsCodeAppendf("\t\tfloat d = length(%s.xy - %s.xy) - %s.z;\n", + builder->fsCodeAppendf("\t\tfloat d = length(%s.xy - %s) - %s.z;\n", circleName, fragmentPos, circleName); } else { - builder->fsCodeAppendf("\t\tfloat d = %s.z - length(%s.xy - %s.xy);\n", + builder->fsCodeAppendf("\t\tfloat d = %s.z - length(%s - %s.xy);\n", circleName, fragmentPos, circleName); } if (GrEffectEdgeTypeIsAA(ce.getEdgeType())) { @@ -318,7 +318,7 @@ void GLEllipseEffect::emitCode(GrGLShaderBuilder* builder, const char* fragmentPos = builder->fragmentPosition(); // d is the offset to the ellipse center - builder->fsCodeAppendf("\t\tvec2 d = %s.xy - %s.xy;\n", fragmentPos, ellipseName); + builder->fsCodeAppendf("\t\tvec2 d = %s - %s.xy;\n", fragmentPos, ellipseName); builder->fsCodeAppendf("\t\tvec2 Z = d * %s.zw;\n", ellipseName); // implicit is the evaluation of (x/rx)^2 + (y/ry)^2 - 1. builder->fsCodeAppend("\t\tfloat implicit = dot(Z, d) - 1.0;\n"); diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp index 11d8a18e61..0f2178b577 100644 --- a/src/gpu/effects/GrRRectEffect.cpp +++ b/src/gpu/effects/GrRRectEffect.cpp @@ -199,8 +199,8 @@ void GLCircularRRectEffect::emitCode(GrGLShaderBuilder* builder, // alphas together. switch (crre.getCircularCornerFlags()) { case CircularRRectEffect::kAll_CornerFlags: - builder->fsCodeAppendf("\t\tvec2 dxy0 = %s.xy - %s.xy;\n", rectName, fragmentPos); - builder->fsCodeAppendf("\t\tvec2 dxy1 = %s.xy - %s.zw;\n", fragmentPos, rectName); + builder->fsCodeAppendf("\t\tvec2 dxy0 = %s.xy - %s;\n", rectName, fragmentPos); + builder->fsCodeAppendf("\t\tvec2 dxy1 = %s - %s.zw;\n", fragmentPos, rectName); builder->fsCodeAppend("\t\tvec2 dxy = max(max(dxy0, dxy1), 0.0);\n"); builder->fsCodeAppendf("\t\tfloat alpha = clamp(%s - length(dxy), 0.0, 1.0);\n", radiusPlusHalfName); @@ -537,8 +537,8 @@ void GLEllipticalRRectEffect::emitCode(GrGLShaderBuilder* builder, // The code below is a simplified version of the above that performs maxs on the vector // components before computing distances and alpha values so that only one distance computation // need be computed to determine the min alpha. - builder->fsCodeAppendf("\t\tvec2 dxy0 = %s.xy - %s.xy;\n", rectName, fragmentPos); - builder->fsCodeAppendf("\t\tvec2 dxy1 = %s.xy - %s.zw;\n", fragmentPos, rectName); + builder->fsCodeAppendf("\t\tvec2 dxy0 = %s.xy - %s;\n", rectName, fragmentPos); + builder->fsCodeAppendf("\t\tvec2 dxy1 = %s - %s.zw;\n", fragmentPos, rectName); switch (erre.getRRect().getType()) { case SkRRect::kSimple_Type: { const char *invRadiiXYSqdName; |