summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-10-25 19:07:33 -0600
committerBrian Paul <[email protected]>2010-10-25 19:21:55 -0600
commit751e10fc0106e929a54d055de7427b3d87a6ffa6 (patch)
tree1e11ec85ec81e03b03399ea88dde49c0667bcb68 /src
parent2d2bafdb30110e83b7e14017326a454d7e7f37f3 (diff)
mesa: additional glReadPixels error checks for GL_EXT_texture_integer
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/readpix.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index e2ce264cf0b..ad27d1192e3 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -28,6 +28,7 @@
#include "context.h"
#include "readpix.h"
#include "framebuffer.h"
+#include "formats.h"
#include "image.h"
#include "state.h"
@@ -185,6 +186,20 @@ _mesa_ReadPixels( 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(rb->Format);
+ const GLboolean dstInteger = _mesa_is_integer_format(format);
+ if (dstInteger != srcInteger) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glReadPixels(integer / non-integer format mismatch");
+ return;
+ }
+ }
+
if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
_mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
"glReadPixels(incomplete framebuffer)" );