Mesa (master): mesa: Add error condition for integer formats in glGetTexImage()

Anuj Phogat aphogat at kemper.freedesktop.org
Thu Apr 17 01:45:48 UTC 2014


Module: Mesa
Branch: master
Commit: cb6566f9df61bfc84c27b382ba3e494bbac782d9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=cb6566f9df61bfc84c27b382ba3e494bbac782d9

Author: Anuj Phogat <anuj.phogat at gmail.com>
Date:   Tue Mar 18 17:01:19 2014 -0700

mesa: Add error condition for integer formats in glGetTexImage()

OpenGL 4.0 spec, page 306 suggests an INVALID_OPERATION in glGetTexImage
if :
   "format is one of the integer formats in table 3.3 and the internal
    format of the texture image is not integer, or format is not one of
    the integer formats in table 3.3 and the internal format is integer."

V2: Use helper function _mesa_is_format_integer()

Cc: <mesa-stable at lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/mesa/main/texgetimage.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index daabf2e..2beb0ab 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -853,6 +853,11 @@ getteximage_error_check(struct gl_context *ctx, GLenum target, GLint level,
       _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
       return GL_TRUE;
    }
+   else if (_mesa_is_enum_format_integer(format) !=
+            _mesa_is_format_integer(texImage->TexFormat)) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
+      return GL_TRUE;
+   }
 
    if (!_mesa_validate_pbo_access(dimensions, &ctx->Pack, texImage->Width,
                                   texImage->Height, texImage->Depth,




More information about the mesa-commit mailing list