[Mesa-dev] [PATCH 17/23] readpix: for implentation format/type, ignore int vs. non-int check

Jordan Justen jordan.l.justen at intel.com
Fri Jan 4 18:41:40 PST 2013


In ES or GL+GL_ARB_ES2_compatibility, the usage of
format = IMPLEMENTATION_COLOR_READ_FORMAT +
type = IMPLEMENTATION_COLOR_READ_TYPE
can function, even if the src/dst int vs. non-int types
differ.

Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
 src/mesa/main/readpix.c |   28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index f21242c..24120e7 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -817,17 +817,25 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
       return;
    }
 
-   /* Check that the destination format and source buffer are both
-    * integer-valued or both non-integer-valued.
-    */
    if (ctx->Extensions.EXT_texture_integer && _mesa_is_color_format(format)) {
-      const struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
-      const GLboolean srcInteger = _mesa_is_format_integer_color(rb->Format);
-      const GLboolean dstInteger = _mesa_is_enum_format_integer(format);
-      if (dstInteger != srcInteger) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glReadPixels(integer / non-integer format mismatch");
-         return;
+      if (_mesa_get_color_read_format(ctx) == format &&
+          _mesa_get_color_read_type(ctx) == type) {
+         /* IMPLEMENTATION_COLOR_READ_FORMAT and
+          * IMPLEMENTATION_COLOR_READ_TYPE are being used. Therefore
+          * we don't need to check integer vs. non-integer below.
+          */
+      } else {
+         /* Check that the destination format and source buffer are both
+          * integer-valued or both non-integer-valued.
+          */
+         const struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
+         const GLboolean srcInteger = _mesa_is_format_integer_color(rb->Format);
+         const GLboolean dstInteger = _mesa_is_enum_format_integer(format);
+         if (dstInteger != srcInteger) {
+            _mesa_error(ctx, GL_INVALID_OPERATION,
+                        "glReadPixels(integer / non-integer format mismatch");
+            return;
+         }
       }
    }
 
-- 
1.7.10.4



More information about the mesa-dev mailing list