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

Unified Diff: src/effects/SkBlurMaskFilter.cpp

Issue 1881513002: Add appendPrecisionModifier method to GrGLSLShaderBuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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 | src/gpu/effects/GrDistanceFieldGeoProc.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkBlurMaskFilter.cpp
diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp
index 609e168f01b043f3154d739e3c56476c820e046c..443373e23be0770df71fca8cf448ff05cca295f0 100644
--- a/src/effects/SkBlurMaskFilter.cpp
+++ b/src/effects/SkBlurMaskFilter.cpp
@@ -723,7 +723,10 @@ void GrGLRectBlurEffect::emitCode(EmitArgs& args) {
const char *rectName;
const char *profileSizeName;
- const char* precisionString = GrGLSLShaderVar::PrecisionString(args.fGLSLCaps, rbe.precision());
+ SkString precisionString;
+ if (args.fGLSLCaps->usesPrecisionModifiers()) {
+ precisionString.printf("%s ", GrGLSLPrecisionString(rbe.precision()));
+ }
fProxyRectUniform = uniformHandler->addUniform(kFragment_GrShaderFlag,
kVec4f_GrSLType,
rbe.precision(),
@@ -744,16 +747,19 @@ void GrGLRectBlurEffect::emitCode(EmitArgs& args) {
fragBuilder->codeAppendf("vec4 src=vec4(1);");
}
- fragBuilder->codeAppendf("%s vec2 translatedPos = %s.xy - %s.xy;", precisionString, fragmentPos,
+ fragBuilder->codeAppendf("%s vec2 translatedPos = %s.xy - %s.xy;", precisionString.c_str(),
+ fragmentPos, rectName);
+ fragBuilder->codeAppendf("%s float width = %s.z - %s.x;", precisionString.c_str(), rectName,
+ rectName);
+ fragBuilder->codeAppendf("%s float height = %s.w - %s.y;", precisionString.c_str(), rectName,
rectName);
- fragBuilder->codeAppendf("%s float width = %s.z - %s.x;", precisionString, rectName, rectName);
- fragBuilder->codeAppendf("%s float height = %s.w - %s.y;", precisionString, rectName, rectName);
-
- fragBuilder->codeAppendf("%s vec2 smallDims = vec2(width - %s, height - %s);", precisionString,
- profileSizeName, profileSizeName);
- fragBuilder->codeAppendf("%s float center = 2.0 * floor(%s/2.0 + .25) - 1.0;", precisionString,
- profileSizeName);
- fragBuilder->codeAppendf("%s vec2 wh = smallDims - vec2(center,center);", precisionString);
+
+ fragBuilder->codeAppendf("%s vec2 smallDims = vec2(width - %s, height - %s);",
+ precisionString.c_str(), profileSizeName, profileSizeName);
+ fragBuilder->codeAppendf("%s float center = 2.0 * floor(%s/2.0 + .25) - 1.0;",
+ precisionString.c_str(), profileSizeName);
+ fragBuilder->codeAppendf("%s vec2 wh = smallDims - vec2(center,center);",
+ precisionString.c_str());
OutputRectBlurProfileLookup(fragBuilder, args.fSamplers[0], "horiz_lookup", profileSizeName,
"translatedPos.x", "width", "wh.x");
« no previous file with comments | « no previous file | src/gpu/effects/GrDistanceFieldGeoProc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698