Fixes for GPU dither

1. Uses device coordinates instead of local coordinates
2. For both int and float variations, interleaves x and (x^y) instead of
   x and y. This matches CPU backend and definition of ordered dithering.

Handling xor in float was a little tricky, but I don't think it's that
many more operations than the step/mod over vec4s from before. It's an
extra operation but restricted to vec2s.

I also updated the way the dither range was provided to the shader.
The float is returned directly from the dither_range_for_color_type function,
and embedded in the shader, instead of mapping from an int to the
appropriate range value. While doing this, I also updated the range value
to be used for 1010102 color types (matching the SkVMBlitter's range),
and a new, appropriate value for 16-bit colors.  Float and half color
types now are not dithered at all (matching raster backend). Previously
these were all treated as a range of 1/255.

We can revisit the range choice before landing this CL if there was
history that made 1/255 a more visually pleasing choice for these high
bit depth color types.

Bug: skia:10290
Change-Id: Ia05c0b84be94efacb83cae295ed2177171c6b249
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292263
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
1 file changed