aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/ops/GrOvalOpFactory.cpp
diff options
context:
space:
mode:
authorGravatar Jim Van Verth <jvanverth@google.com>2016-12-19 14:45:19 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-19 20:37:56 +0000
commit6750e91544b98b839c3148baef996ab2860233a4 (patch)
tree9a7e8446703cf2776737d8cd05bac6179228f937 /src/gpu/ops/GrOvalOpFactory.cpp
parent2410717f900c2691db880d84a2e03a6a24905ee2 (diff)
Fix precision errors in large circle rendering.
BUG=skia:6044 Change-Id: I2ff2a80e1e6798ad18d1c8ec97e8b0fcc731e9af Reviewed-on: https://skia-review.googlesource.com/6281 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
Diffstat (limited to 'src/gpu/ops/GrOvalOpFactory.cpp')
-rw-r--r--src/gpu/ops/GrOvalOpFactory.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gpu/ops/GrOvalOpFactory.cpp b/src/gpu/ops/GrOvalOpFactory.cpp
index b4213ea9a4..7a53ca6655 100644
--- a/src/gpu/ops/GrOvalOpFactory.cpp
+++ b/src/gpu/ops/GrOvalOpFactory.cpp
@@ -82,7 +82,8 @@ public:
fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
kHigh_GrSLPrecision);
fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
- fInCircleEdge = &this->addVertexAttrib("inCircleEdge", kVec4f_GrVertexAttribType);
+ fInCircleEdge = &this->addVertexAttrib("inCircleEdge", kVec4f_GrVertexAttribType,
+ kHigh_GrSLPrecision);
if (clipPlane) {
fInClipPlane = &this->addVertexAttrib("inClipPlane", kVec3f_GrVertexAttribType);
} else {
@@ -129,8 +130,9 @@ private:
// emit attributes
varyingHandler->emitAttributes(cgp);
- fragBuilder->codeAppend("vec4 circleEdge;");
- varyingHandler->addPassThroughAttribute(cgp.fInCircleEdge, "circleEdge");
+ fragBuilder->codeAppend("highp vec4 circleEdge;");
+ varyingHandler->addPassThroughAttribute(cgp.fInCircleEdge, "circleEdge",
+ kHigh_GrSLPrecision);
if (cgp.fInClipPlane) {
fragBuilder->codeAppend("vec3 clipPlane;");
varyingHandler->addPassThroughAttribute(cgp.fInClipPlane, "clipPlane");
@@ -161,7 +163,7 @@ private:
cgp.fLocalMatrix,
args.fFPCoordTransformHandler);
- fragBuilder->codeAppend("float d = length(circleEdge.xy);");
+ fragBuilder->codeAppend("highp float d = length(circleEdge.xy);");
fragBuilder->codeAppend("float distanceToOuterEdge = circleEdge.z * (1.0 - d);");
fragBuilder->codeAppend("float edgeAlpha = clamp(distanceToOuterEdge, 0.0, 1.0);");
if (cgp.fStroke) {