aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects/GrBicubicEffect.cpp
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-09-18 02:41:08 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-18 03:01:47 +0000
commit27185a9b9756d2f5fcc077c6c2c005259d4ba517 (patch)
tree7b1747160cb0fb3fb69ecd61de24f4310ee8cf7b /src/gpu/effects/GrBicubicEffect.cpp
parent56fbbd65807d1c4ff63b5233764c6e15cba51bb4 (diff)
Revert "Revert "Revert "Switched highp float to highfloat and mediump float to half."""
This reverts commit 05d5a13fea6246648de7e41358ed338d53c85ea2. Reason for revert: looks like it broke filterfastbounds Original change's description: > Revert "Revert "Switched highp float to highfloat and mediump float to half."" > > This reverts commit 1d816b92bb7cf2258007f3f74ffd143b89f25d01. > > Bug: skia: > Change-Id: I388b5e5e9bf619db48297a80c9a80c039f26c9f1 > Reviewed-on: https://skia-review.googlesource.com/46464 > Reviewed-by: Brian Salomon <bsalomon@google.com> > Commit-Queue: Ethan Nicholas <ethannicholas@google.com> TBR=bsalomon@google.com,ethannicholas@google.com # Not skipping CQ checks because original CL landed > 1 day ago. Bug: skia: Change-Id: Iddf6aef2ab084aa73da7ceebdfc303a1d2b80cde Reviewed-on: https://skia-review.googlesource.com/47441 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/gpu/effects/GrBicubicEffect.cpp')
-rw-r--r--src/gpu/effects/GrBicubicEffect.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp
index 743b9e094f..7417e29f12 100644
--- a/src/gpu/effects/GrBicubicEffect.cpp
+++ b/src/gpu/effects/GrBicubicEffect.cpp
@@ -42,7 +42,8 @@ void GrGLBicubicEffect::emitCode(EmitArgs& args) {
const GrBicubicEffect& bicubicEffect = args.fFp.cast<GrBicubicEffect>();
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
- fImageIncrementUni = uniformHandler->addUniform(kFragment_GrShaderFlag, kHalf2_GrSLType,
+ fImageIncrementUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
+ kVec2f_GrSLType, kDefault_GrSLPrecision,
"ImageIncrement");
const char* imgInc = uniformHandler->getUniformCStr(fImageIncrementUni);
@@ -70,26 +71,26 @@ void GrGLBicubicEffect::emitCode(EmitArgs& args) {
*
* This is GLSL, so the matrix is column-major (transposed from standard matrix notation).
*/
- fragBuilder->codeAppend("half4x4 kMitchellCoefficients = half4x4("
+ fragBuilder->codeAppend("float4x4 kMitchellCoefficients = float4x4("
" 1.0 / 18.0, 16.0 / 18.0, 1.0 / 18.0, 0.0 / 18.0,"
"-9.0 / 18.0, 0.0 / 18.0, 9.0 / 18.0, 0.0 / 18.0,"
"15.0 / 18.0, -36.0 / 18.0, 27.0 / 18.0, -6.0 / 18.0,"
"-7.0 / 18.0, 21.0 / 18.0, -21.0 / 18.0, 7.0 / 18.0);");
- fragBuilder->codeAppendf("highfloat2 coord = %s - %s * highfloat2(0.5);", coords2D.c_str(), imgInc);
+ fragBuilder->codeAppendf("float2 coord = %s - %s * float2(0.5);", coords2D.c_str(), imgInc);
// We unnormalize the coord in order to determine our fractional offset (f) within the texel
// We then snap coord to a texel center and renormalize. The snap prevents cases where the
// starting coords are near a texel boundary and accumulations of imgInc would cause us to skip/
// double hit a texel.
fragBuilder->codeAppendf("coord /= %s;", imgInc);
- fragBuilder->codeAppend("highfloat2 f = fract(coord);");
- fragBuilder->codeAppendf("coord = (coord - f + highfloat2(0.5)) * %s;", imgInc);
- fragBuilder->codeAppend("half4 wx = kMitchellCoefficients * half4(1.0, f.x, f.x * f.x, f.x * f.x * f.x);");
- fragBuilder->codeAppend("half4 wy = kMitchellCoefficients * half4(1.0, f.y, f.y * f.y, f.y * f.y * f.y);");
- fragBuilder->codeAppend("half4 rowColors[4];");
+ fragBuilder->codeAppend("float2 f = fract(coord);");
+ fragBuilder->codeAppendf("coord = (coord - f + float2(0.5)) * %s;", imgInc);
+ fragBuilder->codeAppend("float4 wx = kMitchellCoefficients * float4(1.0, f.x, f.x * f.x, f.x * f.x * f.x);");
+ fragBuilder->codeAppend("float4 wy = kMitchellCoefficients * float4(1.0, f.y, f.y * f.y, f.y * f.y * f.y);");
+ fragBuilder->codeAppend("float4 rowColors[4];");
for (int y = 0; y < 4; ++y) {
for (int x = 0; x < 4; ++x) {
SkString coord;
- coord.printf("coord + %s * highfloat2(%d, %d)", imgInc, x - 1, y - 1);
+ coord.printf("coord + %s * float2(%d, %d)", imgInc, x - 1, y - 1);
SkString sampleVar;
sampleVar.printf("rowColors[%d]", x);
fDomain.sampleTexture(fragBuilder,
@@ -101,7 +102,7 @@ void GrGLBicubicEffect::emitCode(EmitArgs& args) {
args.fTexSamplers[0]);
}
fragBuilder->codeAppendf(
- "half4 s%d = wx.x * rowColors[0] + wx.y * rowColors[1] + wx.z * rowColors[2] + wx.w * rowColors[3];",
+ "float4 s%d = wx.x * rowColors[0] + wx.y * rowColors[1] + wx.z * rowColors[2] + wx.w * rowColors[3];",
y);
}
SkString bicubicColor("(wy.x * s0 + wy.y * s1 + wy.z * s2 + wy.w * s3)");