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

Unified Diff: src/gpu/effects/GrRRectEffect.cpp

Issue 1256353004: Fix elliptical rrect clip shaders for large radii on devices with mediump (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rename file Created 5 years, 4 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 | « src/gpu/effects/GrOvalEffect.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrRRectEffect.cpp
diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp
index c95690ff195e0f1c944e596448658ceb36578d5a..dcc8944a23b5b16dfbd9c790bb02814fb021c42d 100644
--- a/src/gpu/effects/GrRRectEffect.cpp
+++ b/src/gpu/effects/GrRRectEffect.cpp
@@ -509,16 +509,18 @@ void GLEllipticalRRectEffect::emitCode(EmitArgs& args) {
// fragments near the other three edges will get the correct AA. Fragments in the interior of
// the rrect will have a (0,0) vector at all four corners. So long as the radii > 0.5 they will
// correctly produce an alpha value of 1 at all four corners. We take the min of all the alphas.
+ //
// 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.
fsBuilder->codeAppendf("\t\tvec2 dxy0 = %s.xy - %s.xy;\n", rectName, fragmentPos);
fsBuilder->codeAppendf("\t\tvec2 dxy1 = %s.xy - %s.zw;\n", fragmentPos, rectName);
+ // The uniforms with the inv squared radii are highp to prevent underflow.
switch (erre.getRRect().getType()) {
case SkRRect::kSimple_Type: {
const char *invRadiiXYSqdName;
fInvRadiiSqdUniform = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
- kVec2f_GrSLType, kDefault_GrSLPrecision,
+ kVec2f_GrSLType, kHigh_GrSLPrecision,
"invRadiiXY",
&invRadiiXYSqdName);
fsBuilder->codeAppend("\t\tvec2 dxy = max(max(dxy0, dxy1), 0.0);\n");
@@ -529,7 +531,7 @@ void GLEllipticalRRectEffect::emitCode(EmitArgs& args) {
case SkRRect::kNinePatch_Type: {
const char *invRadiiLTRBSqdName;
fInvRadiiSqdUniform = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
- kVec4f_GrSLType, kDefault_GrSLPrecision,
+ kVec4f_GrSLType, kHigh_GrSLPrecision,
"invRadiiLTRB",
&invRadiiLTRBSqdName);
fsBuilder->codeAppend("\t\tvec2 dxy = max(max(dxy0, dxy1), 0.0);\n");
« no previous file with comments | « src/gpu/effects/GrOvalEffect.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698