aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects/GrEllipseEffect.fp
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-08-17 11:07:59 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-17 15:08:17 +0000
commit1d816b92bb7cf2258007f3f74ffd143b89f25d01 (patch)
tree07fb1e8e2631208eb007a4abdfe130db91e6cfc2 /src/gpu/effects/GrEllipseEffect.fp
parent23f92277b916a4bdf11c320799ac9248af60a62e (diff)
Revert "Switched highp float to highfloat and mediump float to half."
This reverts commit 88d99c63878c2d3d340120f0321676f72afcb4f0. Reason for revert: Believed to be causing unit test failures in Chrome roll: https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/364433 https://luci-logdog.appspot.com/v/?s=chromium%2Fbb%2Ftryserver.chromium.android%2Flinux_android_rel_ng%2F364433%2F%2B%2Frecipes%2Fsteps%2Fcontent_browsertests__with_patch__on_Android%2F0%2Flogs%2FWebRtcCaptureFromElementBrowserTest.VerifyCanvasWebGLCaptureColor%2F0 Original change's description: > Switched highp float to highfloat and mediump float to half. > > The ultimate goal is to end up with "float" and "half", but this > intermediate step uses "highfloat" so that it is clear if I missed a > "float" somewhere. Once this lands, a subsequent CL will switch all > "highfloats" back to "floats". > > Bug: skia: > Change-Id: Ia13225c7a0a0a2901e07665891c473d2500ddcca > Reviewed-on: https://skia-review.googlesource.com/31000 > Commit-Queue: Ethan Nicholas <ethannicholas@google.com> > Reviewed-by: Brian Salomon <bsalomon@google.com> TBR=bsalomon@google.com,csmartdalton@google.com,ethannicholas@google.com Change-Id: I8bfa97547ac3920d433665f161d27df3f15c83aa No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/35705 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/effects/GrEllipseEffect.fp')
-rw-r--r--src/gpu/effects/GrEllipseEffect.fp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/gpu/effects/GrEllipseEffect.fp b/src/gpu/effects/GrEllipseEffect.fp
index 3663d5622e..85c4c96f75 100644
--- a/src/gpu/effects/GrEllipseEffect.fp
+++ b/src/gpu/effects/GrEllipseEffect.fp
@@ -6,17 +6,17 @@
*/
layout(key) in int edgeType;
-in half2 center;
-in half2 radii;
+in float2 center;
+in float2 radii;
-half2 prevCenter;
-half2 prevRadii = half2(-1);
+float2 prevCenter;
+float2 prevRadii = float2(-1);
// The ellipse uniform is (center.x, center.y, 1 / rx^2, 1 / ry^2)
-// The last two terms can underflow with halfs, so we use floats.
-uniform highfloat4 ellipse;
+// The last two terms can underflow on mediump, so we use highp.
+uniform highp float4 ellipse;
bool useScale = sk_Caps.floatPrecisionVaries;
-layout(when=useScale) uniform half2 scale;
+layout(when=useScale) uniform float2 scale;
@optimizationFlags { kCompatibleWithCoverageAsAlpha_OptimizationFlag }
@@ -50,7 +50,7 @@ layout(when=useScale) uniform half2 scale;
void main() {
// d is the offset to the ellipse center
- half2 d = sk_FragCoord.xy - ellipse.xy;
+ float2 d = sk_FragCoord.xy - ellipse.xy;
// If we're on a device with a "real" mediump then we'll do the distance computation in a space
// that is normalized by the larger radius. The scale uniform will be scale, 1/scale. The
// inverse squared radii uniform values are already in this normalized space. The center is
@@ -58,19 +58,19 @@ void main() {
@if (useScale) {
d *= scale.y;
}
- half2 Z = d * ellipse.zw;
+ float2 Z = d * ellipse.zw;
// implicit is the evaluation of (x/rx)^2 + (y/ry)^2 - 1.
- half implicit = dot(Z, d) - 1;
+ float implicit = dot(Z, d) - 1;
// grad_dot is the squared length of the gradient of the implicit.
- half grad_dot = 4 * dot(Z, Z);
+ float grad_dot = 4 * dot(Z, Z);
// Avoid calling inversesqrt on zero.
grad_dot = max(grad_dot, 1e-4);
- half approx_dist = implicit * inversesqrt(grad_dot);
+ float approx_dist = implicit * inversesqrt(grad_dot);
@if (useScale) {
approx_dist *= scale.x;
}
- half alpha;
+ float alpha;
@switch (edgeType) {
case 0 /* kFillBW_GrProcessorEdgeType */:
alpha = approx_dist > 0.0 ? 0.0 : 1.0;