summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/readpix.c
diff options
context:
space:
mode:
authorJordan Justen <jordan.l.justen@intel.com>2012-12-28 11:27:04 -0800
committerMatt Turner <mattst88@gmail.com>2013-01-20 19:54:38 -0800
commitce9118c7f053e68102e215c7cf57a6d1b68d5955 (patch)
treefa5a465a938bd1e16855f583c602e67bb837bf05 /src/mesa/main/readpix.c
parent8b0bc9de367b4bada8a733d31e5889e5a9de91d8 (diff)
downloadexternal_mesa3d-ce9118c7f053e68102e215c7cf57a6d1b68d5955.zip
external_mesa3d-ce9118c7f053e68102e215c7cf57a6d1b68d5955.tar.gz
external_mesa3d-ce9118c7f053e68102e215c7cf57a6d1b68d5955.tar.bz2
readpix: check FBO completeness before trying to access the read-buffer
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Diffstat (limited to 'src/mesa/main/readpix.c')
-rw-r--r--src/mesa/main/readpix.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index d9c840e..cb4d02d 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -746,6 +746,15 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
return;
}
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+
+ if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
+ _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
+ "glReadPixels(incomplete framebuffer)" );
+ return;
+ }
+
rb = _mesa_get_read_renderbuffer_for_format(ctx, format);
if (rb == NULL) {
_mesa_error(ctx, GL_INVALID_OPERATION,
@@ -786,9 +795,6 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
}
}
- if (ctx->NewState)
- _mesa_update_state(ctx);
-
err = _mesa_error_check_format_and_type(ctx, format, type);
if (err != GL_NO_ERROR) {
_mesa_error(ctx, err, "glReadPixels(invalid format %s and/or type %s)",
@@ -797,12 +803,6 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
return;
}
- if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
- _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
- "glReadPixels(incomplete framebuffer)" );
- return;
- }
-
if (_mesa_is_user_fbo(ctx->ReadBuffer) &&
ctx->ReadBuffer->Visual.samples > 0) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(multisample FBO)");