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

Nick Kreeger nick.kreeger at gmail.com
Wed Dec 12 05:10:51 UTC 2018


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.
---
 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;
                }
             }
-- 
2.17.1



More information about the mesa-dev mailing list