[Mesa-dev] [PATCH] mesa: ES2 glReadPixels support for OES float extensions.

Tapani Pälli tapani.palli at intel.com
Wed Dec 12 09:08:56 UTC 2018


On 12/12/18 7:10 AM, Nick Kreeger wrote:
> The OES extensions for float/half-float allow glReadPixels to read
> GL_RGBA values as GL_FLOAT for both floats and half-floats. This patch
> ensures that ES2 context versions allows this if at least one of the
> extensions is present.

Reading the extension spec, I don't see any changes to glReadPixels section:

https://www.khronos.org/registry/OpenGL/extensions/OES/OES_texture_float.txt

EXT_color_buffer_float (that requires ES 3.0) and OpenGL ES 3.2 add 
following text:

"For floating-point rendering surfaces, the combi-
nation format RGBA and type FLOAT is accepted."

That seems to be handled properly in read_pixels_es3_error_check.

> ---
>   src/mesa/main/readpix.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
> index 556c860d39..59f14a6563 100644
> --- a/src/mesa/main/readpix.c
> +++ b/src/mesa/main/readpix.c
> @@ -1084,7 +1084,8 @@ read_pixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format,
>            } else if (ctx->Version < 30) {
>               err = _mesa_es_error_check_format_and_type(ctx, format, type, 2);
>               if (err == GL_NO_ERROR) {
> -               if (type == GL_FLOAT || type == GL_HALF_FLOAT_OES) {
> +               if ((type == GL_FLOAT || type == GL_HALF_FLOAT_OES) &&
> +                   (!_mesa_has_OES_texture_float(ctx) && !_mesa_has_OES_texture_half_float(ctx))) {
>                     err = GL_INVALID_OPERATION;
>                  }
>               }
> 


More information about the mesa-dev mailing list