diff options
author | Brian Osman <brianosman@google.com> | 2017-11-07 15:39:55 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-11-07 21:01:14 +0000 |
commit | 43a0aa5f0d6f284fa43b5c7f637297ecc5c149e1 (patch) | |
tree | e5551137dbebd5225fbb59aac406940aba77e153 /src/effects/SkHighContrastFilter.cpp | |
parent | 94fd356cc0886e1110923cf98a9a4a58ce35df97 (diff) |
Fix highcontrastfilter on ANGLE D3D9
On NVIDIA and Intel GPUs, running the angle_d3d9_es2 config, we were
getting the wrong result from the HSL conversion. From debugging the
shader, it seems that max(x, y) is not necessarily equal to either x
or y. Tried several ways to fix it, but the only reasonably one that
worked was to alter our conditionals. This is slower, but the filter
is already doing a large amount of work.
Bug: skia:7273
Change-Id: I9724285a0d5834cf98189df9efbdc02b5e1de4a7
Reviewed-on: https://skia-review.googlesource.com/68213
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/effects/SkHighContrastFilter.cpp')
-rw-r--r-- | src/effects/SkHighContrastFilter.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/effects/SkHighContrastFilter.cpp b/src/effects/SkHighContrastFilter.cpp index b1900f0567..9df04c110b 100644 --- a/src/effects/SkHighContrastFilter.cpp +++ b/src/effects/SkHighContrastFilter.cpp @@ -298,10 +298,13 @@ void GLHighContrastFilterEffect::emitCode(EmitArgs& args) { fragBuilder->codeAppendf(" s = l > 0.5 ?"); fragBuilder->codeAppendf(" d / (2 - fmax - fmin) :"); fragBuilder->codeAppendf(" d / (fmax + fmin);"); - fragBuilder->codeAppendf(" if (fmax == color.r) {"); + // We'd like to just write "if (color.r == fmax) { ... }". On many GPUs, running the + // angle_d3d9_es2 config, that failed. It seems that max(x, y) is not necessarily equal + // to either x or y. Tried several ways to fix it, but this was the only reasonable fix. + fragBuilder->codeAppendf(" if (color.r >= color.g && color.r >= color.b) {"); fragBuilder->codeAppendf(" h = (color.g - color.b) / d + "); fragBuilder->codeAppendf(" (color.g < color.b ? 6 : 0);"); - fragBuilder->codeAppendf(" } else if (fmax == color.g) {"); + fragBuilder->codeAppendf(" } else if (color.g >= color.b) {"); fragBuilder->codeAppendf(" h = (color.b - color.r) / d + 2;"); fragBuilder->codeAppendf(" } else {"); fragBuilder->codeAppendf(" h = (color.r - color.g) / d + 4;"); |