aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects/GrConfigConversionEffect.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/effects/GrConfigConversionEffect.cpp')
-rw-r--r--src/gpu/effects/GrConfigConversionEffect.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index 668423d8d2..2cf7919543 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -20,14 +20,17 @@ public:
const GrConfigConversionEffect& cce = args.fFp.cast<GrConfigConversionEffect>();
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
+ // Use highp throughout the shader to avoid some precision issues on specific GPUs.
+ fragBuilder->elevateDefaultPrecision(kHigh_GrSLPrecision);
+
if (nullptr == args.fInputColor) {
// could optimize this case, but we aren't for now.
- args.fInputColor = "half4(1)";
+ args.fInputColor = "float4(1)";
}
// Aggressively round to the nearest exact (N / 255) floating point value. This lets us
// find a round-trip preserving pair on some GPUs that do odd byte to float conversion.
- fragBuilder->codeAppendf("half4 color = floor(%s * 255.0 + 0.5) / 255.0;", args.fInputColor);
+ fragBuilder->codeAppendf("float4 color = floor(%s * 255.0 + 0.5) / 255.0;", args.fInputColor);
switch (cce.pmConversion()) {
case GrConfigConversionEffect::kToPremul_PMConversion:
@@ -37,7 +40,7 @@ public:
case GrConfigConversionEffect::kToUnpremul_PMConversion:
fragBuilder->codeAppend(
- "color.rgb = color.a <= 0.0 ? half3(0,0,0) : floor(color.rgb / color.a * 255.0 + 0.5) / 255.0;");
+ "color.rgb = color.a <= 0.0 ? float3(0,0,0) : floor(color.rgb / color.a * 255.0 + 0.5) / 255.0;");
break;
default: