aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects/GrTextureDomain.cpp
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-09-15 11:42:17 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-15 18:50:54 +0000
commit05d5a13fea6246648de7e41358ed338d53c85ea2 (patch)
tree695fdbeae1116f8ce813288e47b31c2a99f28f1f /src/gpu/effects/GrTextureDomain.cpp
parent49f1f34438d3431f6d7e32847accd2ba96948a73 (diff)
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>
Diffstat (limited to 'src/gpu/effects/GrTextureDomain.cpp')
-rw-r--r--src/gpu/effects/GrTextureDomain.cpp30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp
index 3bb96b23cd..c297560cea 100644
--- a/src/gpu/effects/GrTextureDomain.cpp
+++ b/src/gpu/effects/GrTextureDomain.cpp
@@ -78,8 +78,7 @@ void GrTextureDomain::GLDomain::sampleTexture(GrGLSLShaderBuilder* builder,
if (textureDomain.fIndex >= 0) {
uniName.appendS32(textureDomain.fIndex);
}
- fDomainUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
- kVec4f_GrSLType, kDefault_GrSLPrecision,
+ fDomainUni = uniformHandler->addUniform(kFragment_GrShaderFlag, kHalf4_GrSLType,
uniName.c_str(), &name);
fDomainName = name;
}
@@ -88,7 +87,7 @@ void GrTextureDomain::GLDomain::sampleTexture(GrGLSLShaderBuilder* builder,
case kIgnore_Mode: {
builder->codeAppendf("%s = ", outColor);
builder->appendTextureLookupAndModulate(inModulateColor, sampler, inCoords.c_str(),
- kVec2f_GrSLType, colorXformHelper);
+ kHighFloat2_GrSLType, colorXformHelper);
builder->codeAppend(";");
break;
}
@@ -99,7 +98,7 @@ void GrTextureDomain::GLDomain::sampleTexture(GrGLSLShaderBuilder* builder,
builder->codeAppendf("%s = ", outColor);
builder->appendTextureLookupAndModulate(inModulateColor, sampler, clampedCoords.c_str(),
- kVec2f_GrSLType, colorXformHelper);
+ kHighFloat2_GrSLType, colorXformHelper);
builder->codeAppend(";");
break;
}
@@ -115,20 +114,20 @@ void GrTextureDomain::GLDomain::sampleTexture(GrGLSLShaderBuilder* builder,
// may return undefined results". This appears to be an issue with
// the 'any' call since even the simple "result=black; if (any())
// result=white;" code fails to compile.
- builder->codeAppend("float4 outside = float4(0.0, 0.0, 0.0, 0.0);");
- builder->codeAppend("float4 inside = ");
+ builder->codeAppend("half4 outside = half4(0.0, 0.0, 0.0, 0.0);");
+ builder->codeAppend("half4 inside = ");
builder->appendTextureLookupAndModulate(inModulateColor, sampler, inCoords.c_str(),
- kVec2f_GrSLType, colorXformHelper);
+ kHighFloat2_GrSLType, colorXformHelper);
builder->codeAppend(";");
- builder->codeAppendf("highp float x = (%s).x;", inCoords.c_str());
- builder->codeAppendf("highp float y = (%s).y;", inCoords.c_str());
+ builder->codeAppendf("highfloat x = (%s).x;", inCoords.c_str());
+ builder->codeAppendf("highfloat y = (%s).y;", inCoords.c_str());
builder->codeAppendf("x = abs(2.0*(x - %s.x)/(%s.z - %s.x) - 1.0);",
domain, domain, domain);
builder->codeAppendf("y = abs(2.0*(y - %s.y)/(%s.w - %s.y) - 1.0);",
domain, domain, domain);
- builder->codeAppend("float blend = step(1.0, max(x, y));");
+ builder->codeAppend("half blend = step(1.0, max(x, y));");
builder->codeAppendf("%s = mix(inside, outside, blend);", outColor);
} else {
builder->codeAppend("bool4 outside;\n");
@@ -136,10 +135,10 @@ void GrTextureDomain::GLDomain::sampleTexture(GrGLSLShaderBuilder* builder,
domain);
builder->codeAppendf("outside.zw = greaterThan(%s, %s.zw);", inCoords.c_str(),
domain);
- builder->codeAppendf("%s = any(outside) ? float4(0.0, 0.0, 0.0, 0.0) : ",
+ builder->codeAppendf("%s = any(outside) ? half4(0.0, 0.0, 0.0, 0.0) : ",
outColor);
builder->appendTextureLookupAndModulate(inModulateColor, sampler, inCoords.c_str(),
- kVec2f_GrSLType, colorXformHelper);
+ kHighFloat2_GrSLType, colorXformHelper);
builder->codeAppend(";");
}
break;
@@ -152,7 +151,7 @@ void GrTextureDomain::GLDomain::sampleTexture(GrGLSLShaderBuilder* builder,
builder->codeAppendf("%s = ", outColor);
builder->appendTextureLookupAndModulate(inModulateColor, sampler, clampedCoords.c_str(),
- kVec2f_GrSLType, colorXformHelper);
+ kHighFloat2_GrSLType, colorXformHelper);
builder->codeAppend(";");
break;
}
@@ -377,11 +376,10 @@ GrGLSLFragmentProcessor* GrDeviceSpaceTextureDecalFragmentProcessor::onCreateGLS
args.fFp.cast<GrDeviceSpaceTextureDecalFragmentProcessor>();
const char* scaleAndTranslateName;
fScaleAndTranslateUni = args.fUniformHandler->addUniform(kFragment_GrShaderFlag,
- kVec4f_GrSLType,
- kDefault_GrSLPrecision,
+ kHalf4_GrSLType,
"scaleAndTranslate",
&scaleAndTranslateName);
- args.fFragBuilder->codeAppendf("float2 coords = sk_FragCoord.xy * %s.xy + %s.zw;",
+ args.fFragBuilder->codeAppendf("half2 coords = sk_FragCoord.xy * %s.xy + %s.zw;",
scaleAndTranslateName, scaleAndTranslateName);
fGLDomain.sampleTexture(args.fFragBuilder,
args.fUniformHandler,