Always use GL_HALF_FLOAT_OES on ANGLE, even with ES3.
In the past, ANGLE always used GL_HALF_FLOAT. I filed a bug about that,
and they switched to HALF_FLOAT_OES. However, ES3 has direct support for
HALF_FLOAT, so we expect that as the format for read pixels.
The better solution would be to remember and return the value we get
back from IMPLEMENTATION_COLOR_READ_TYPE, but there are subtleties that
create additional bugs when we do that. In particular:
If trying to read Alpha8 from RGBA, the current sequence is:
1. readPixelsSupported asks for the format to use. getExternalFormat
switches out the format (assuming we're using GL_RED). This creates
a format/type pair that fails the ES3.2 rules (16.1.2), so we ask
the driver for the secondary format, which matches the one that we
expect (from our config table).
2. Then we *actually* do the readPixels, and here we just call
getReadPixelsFormat, which does the remapping, but skips the follow
up checks in readPixelsSupported. So we end up passing a format/type
pair that our code in readPixelsSupported thinks is illegal (and
which is neither the pair that our config table stores, *nor* the
pair returned by the implementation).
A straightforward solution of the original problem is to notice that
we had to ask the implementation (because the values are filled in),
so we should trust those and not the ones in the config table. But then
we miss out on the chance to overwrite the values for the alpha only
from RGBA case. Sigh.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4963
Change-Id: Icb0c151c9f07ffc178ed3a597fa8ab0ed3c6cb94
Reviewed-on: https://skia-review.googlesource.com/4963
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2 files changed