aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects/SkDisplacementMapEffect.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/effects/SkDisplacementMapEffect.cpp')
-rw-r--r--src/effects/SkDisplacementMapEffect.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index ff17af1a48..31f6dc5f47 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -552,8 +552,7 @@ void GrGLDisplacementMapEffect::emitCode(EmitArgs& args) {
const GrDisplacementMapEffect& displacementMap = args.fFp.cast<GrDisplacementMapEffect>();
const GrTextureDomain& domain = displacementMap.domain();
- fScaleUni = args.fUniformHandler->addUniform(kFragment_GrShaderFlag,
- kVec2f_GrSLType, kDefault_GrSLPrecision, "Scale");
+ fScaleUni = args.fUniformHandler->addUniform(kFragment_GrShaderFlag, kHalf2_GrSLType, "Scale");
const char* scaleUni = args.fUniformHandler->getUniformCStr(fScaleUni);
const char* dColor = "dColor";
const char* cCoords = "cCoords";
@@ -564,17 +563,17 @@ void GrGLDisplacementMapEffect::emitCode(EmitArgs& args) {
fColorSpaceHelper.emitCode(args.fUniformHandler, displacementMap.colorSpaceXform());
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
- fragBuilder->codeAppendf("\t\tfloat4 %s = ", dColor);
+ fragBuilder->codeAppendf("\t\thalf4 %s = ", dColor);
fragBuilder->appendTextureLookup(args.fTexSamplers[0], args.fTransformedCoords[0].c_str(),
args.fTransformedCoords[0].getType());
fragBuilder->codeAppend(";\n");
// Unpremultiply the displacement
fragBuilder->codeAppendf(
- "\t\t%s.rgb = (%s.a < %s) ? float3(0.0) : clamp(%s.rgb / %s.a, 0.0, 1.0);",
+ "\t\t%s.rgb = (%s.a < %s) ? half3(0.0) : clamp(%s.rgb / %s.a, 0.0, 1.0);",
dColor, dColor, nearZero, dColor, dColor);
SkString coords2D = fragBuilder->ensureCoords2D(args.fTransformedCoords[1]);
- fragBuilder->codeAppendf("\t\tfloat2 %s = %s + %s*(%s.",
+ fragBuilder->codeAppendf("\t\thighfloat2 %s = %s + %s*(%s.",
cCoords, coords2D.c_str(), scaleUni, dColor);
switch (displacementMap.xChannelSelector()) {
@@ -612,7 +611,7 @@ void GrGLDisplacementMapEffect::emitCode(EmitArgs& args) {
default:
SkDEBUGFAIL("Unknown Y channel selector");
}
- fragBuilder->codeAppend("-float2(0.5));\t\t");
+ fragBuilder->codeAppend("-half2(0.5));\t\t");
fGLDomain.sampleTexture(fragBuilder,
args.fUniformHandler,