diff options
author | cdalton <cdalton@nvidia.com> | 2016-04-11 11:30:50 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-11 11:30:50 -0700 |
commit | 1f50acff0dc09e50cc207846508d8e6459334b2a (patch) | |
tree | 0d2aa98915e50223a84c771dce0f42b9c2ea04b6 /src/effects | |
parent | fef28606d2c51be627be3a656581882e31945c03 (diff) |
Add appendPrecisionModifier method to GrGLSLShaderBuilder
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1881513002
Review URL: https://codereview.chromium.org/1881513002
Diffstat (limited to 'src/effects')
-rw-r--r-- | src/effects/SkBlurMaskFilter.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp index 609e168f01..443373e23b 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"); |