aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects/GrRectBlurEffect.cpp
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2018-07-12 14:02:00 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-19 19:00:55 +0000
commit97ae0c89025dfd791047f5701e57d58da37c125c (patch)
treed944775c2c88dd36d5e40fb6c1bae5c7c2376e3b /src/gpu/effects/GrRectBlurEffect.cpp
parent310f44d3d5298becdd8ab235af29789f6ed769b5 (diff)
Revert "Revert "added GrSkSLFP and converted DitherEffect to use it""
This reverts commit f2030783094e502fb74221077a5ee7cb41287fe4. Bug: skia: Change-Id: Icaaa8b3ea652a8f126bfbcc788a360493a7ebe3e Reviewed-on: https://skia-review.googlesource.com/137391 Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/effects/GrRectBlurEffect.cpp')
-rw-r--r--src/gpu/effects/GrRectBlurEffect.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/gpu/effects/GrRectBlurEffect.cpp b/src/gpu/effects/GrRectBlurEffect.cpp
index 219fefa713..d423b786ce 100644
--- a/src/gpu/effects/GrRectBlurEffect.cpp
+++ b/src/gpu/effects/GrRectBlurEffect.cpp
@@ -46,13 +46,13 @@ public:
fProfileSizeVar = args.fUniformHandler->addUniform(kFragment_GrShaderFlag, kHalf_GrSLType,
kDefault_GrSLPrecision, "profileSize");
fragBuilder->codeAppendf(
- "bool highPrecision = %s;\n@if (highPrecision) {\n float2 translatedPos = "
- "sk_FragCoord.xy - %s.xy;\n float width = %s.z - %s.x;\n float height = %s.w "
- "- %s.y;\n float2 smallDims = float2(width - float(%s), height - float(%s));\n "
- " float center = 2.0 * floor(float(float(%s / 2.0) + 0.25)) - 1.0;\n float2 wh "
- "= smallDims - float2(center, center);\n half hcoord = "
- "half((abs(translatedPos.x - 0.5 * width) - 0.5 * wh.x) / float(%s));\n half "
- "hlookup = texture(%s, float2(float(hcoord), 0.5)).%s.w",
+ "/* key */ bool highPrecision = %s;\n@if (highPrecision) {\n float2 "
+ "translatedPos = sk_FragCoord.xy - %s.xy;\n float width = %s.z - %s.x;\n "
+ "float height = %s.w - %s.y;\n float2 smallDims = float2(width - float(%s), "
+ "height - float(%s));\n float center = 2.0 * floor(float(float(%s / 2.0) + "
+ "0.25)) - 1.0;\n float2 wh = smallDims - float2(center, center);\n half "
+ "hcoord = half((abs(translatedPos.x - 0.5 * width) - 0.5 * wh.x) / float(%s));\n "
+ " half hlookup = texture(%s, float2(float(hcoord), ",
(highPrecision ? "true" : "false"), args.fUniformHandler->getUniformCStr(fRectVar),
args.fUniformHandler->getUniformCStr(fRectVar),
args.fUniformHandler->getUniformCStr(fRectVar),
@@ -62,16 +62,16 @@ public:
args.fUniformHandler->getUniformCStr(fProfileSizeVar),
args.fUniformHandler->getUniformCStr(fProfileSizeVar),
args.fUniformHandler->getUniformCStr(fProfileSizeVar),
- fragBuilder->getProgramBuilder()->samplerVariable(args.fTexSamplers[0]).c_str(),
- fragBuilder->getProgramBuilder()->samplerSwizzle(args.fTexSamplers[0]).c_str());
+ fragBuilder->getProgramBuilder()->samplerVariable(args.fTexSamplers[0]).c_str());
fragBuilder->codeAppendf(
- ";\n half vcoord = half((abs(translatedPos.y - 0.5 * height) - 0.5 * wh.y) / "
- "float(%s));\n half vlookup = texture(%s, float2(float(vcoord), 0.5)).%s.w;\n "
- " %s = (%s * hlookup) * vlookup;\n} else {\n half2 translatedPos = "
- "half2(sk_FragCoord.xy - %s.xy);\n half width = half(%s.z - %s.x);\n half "
- "height = half(%s.w - %s.y);\n half2 smallDims = half2(width - %s, height - "
- "%s);\n half center = half(2.0 * floor(float(float(%s / 2.0) + 0.25)) - 1.0);\n "
- " half2 wh = smallDims - half2(float2(floa",
+ "0.5)).%s.w;\n half vcoord = half((abs(translatedPos.y - 0.5 * height) - 0.5 * "
+ "wh.y) / float(%s));\n half vlookup = texture(%s, float2(float(vcoord), "
+ "0.5)).%s.w;\n %s = (%s * hlookup) * vlookup;\n} else {\n half2 "
+ "translatedPos = half2(sk_FragCoord.xy - %s.xy);\n half width = half(%s.z - "
+ "%s.x);\n half height = half(%s.w - %s.y);\n half2 smallDims = half2(width - "
+ "%s, height - %s);\n half center = half(2.0 * floor(float(float(%s / 2.0) + "
+ "0.25)) - 1.0);\n half2 wh = smallDims - half2(f",
+ fragBuilder->getProgramBuilder()->samplerSwizzle(args.fTexSamplers[0]).c_str(),
args.fUniformHandler->getUniformCStr(fProfileSizeVar),
fragBuilder->getProgramBuilder()->samplerVariable(args.fTexSamplers[0]).c_str(),
fragBuilder->getProgramBuilder()->samplerSwizzle(args.fTexSamplers[0]).c_str(),
@@ -85,7 +85,7 @@ public:
args.fUniformHandler->getUniformCStr(fProfileSizeVar),
args.fUniformHandler->getUniformCStr(fProfileSizeVar));
fragBuilder->codeAppendf(
- "t(center), float(center)));\n half hcoord = "
+ "loat2(float(center), float(center)));\n half hcoord = "
"half((abs(float(float(translatedPos.x) - 0.5 * float(width))) - 0.5 * "
"float(wh.x)) / float(%s));\n half hlookup = texture(%s, float2(float(hcoord), "
"0.5)).%s.w;\n half vcoord = half((abs(float(float(translatedPos.y) - 0.5 * "