diff options
author | Brian Salomon <bsalomon@google.com> | 2018-04-03 09:58:37 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-04-03 15:20:50 +0000 |
commit | 08c39fcbcb68f5b0081ec69b4f5bd3c8dff23f9f (patch) | |
tree | 6eb04d0e3d3f27fdc31ec224b36fab3be9d804dc /src | |
parent | 4db18edb95c8aa4ce71476ae9dd9c05e3d6a3d9f (diff) |
Increase precision in GrSRGBEffect
Allows ApplyGammaTest to pass on Bifrost, which uses fp16 for mediump.
Change-Id: Icd04001939a2cb7e1789132ab035ca498c92112a
Reviewed-on: https://skia-review.googlesource.com/118162
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/effects/GrSRGBEffect.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gpu/effects/GrSRGBEffect.cpp b/src/gpu/effects/GrSRGBEffect.cpp index 7e823eaae7..6ca975919d 100644 --- a/src/gpu/effects/GrSRGBEffect.cpp +++ b/src/gpu/effects/GrSRGBEffect.cpp @@ -47,7 +47,9 @@ public: args.fInputColor = "half4(1)"; } - fragBuilder->codeAppendf("half4 color = %s;", args.fInputColor); + // Mali Bifrost uses fp16 for mediump. Making the intermediate color variable highp causes + // calculations to be performed with sufficient precision. + fragBuilder->codeAppendf("float4 color = %s;", args.fInputColor); if (srgbe.alpha() == GrSRGBEffect::Alpha::kPremul) { fragBuilder->codeAppendf("half nonZeroAlpha = max(color.a, 0.00001);"); fragBuilder->codeAppendf("color = half4(color.rgb / nonZeroAlpha, color.a);"); |