diff options
author | marha <marha@users.sourceforge.net> | 2011-04-27 15:56:59 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-04-27 15:56:59 +0000 |
commit | 100633b3e7619842f345cb7603b0db6b5761dd11 (patch) | |
tree | 3c3af754c7e801c07263269837d6a05072ff834c /mesalib/src/mesa/main/readpix.c | |
parent | 205a4bdae76f287126db9f45a4f0ba631e3efca1 (diff) | |
parent | 96d6df5da9cddedf4931bf8e17f96e242467c661 (diff) | |
download | vcxsrv-100633b3e7619842f345cb7603b0db6b5761dd11.tar.gz vcxsrv-100633b3e7619842f345cb7603b0db6b5761dd11.tar.bz2 vcxsrv-100633b3e7619842f345cb7603b0db6b5761dd11.zip |
svn merge ^/branches/released .
Diffstat (limited to 'mesalib/src/mesa/main/readpix.c')
-rw-r--r-- | mesalib/src/mesa/main/readpix.c | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/mesalib/src/mesa/main/readpix.c b/mesalib/src/mesa/main/readpix.c index 864e5b6dc..e9f5b3c41 100644 --- a/mesalib/src/mesa/main/readpix.c +++ b/mesalib/src/mesa/main/readpix.c @@ -167,8 +167,9 @@ _mesa_error_check_format_type(struct gl_context *ctx, GLenum format, void GLAPIENTRY
-_mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type, GLvoid *pixels )
+_mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type, GLsizei bufSize,
+ GLvoid *pixels )
{
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
@@ -224,21 +225,33 @@ _mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, if (width == 0 || height == 0)
return; /* nothing to do */
- if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
- if (!_mesa_validate_pbo_access(2, &ctx->Pack, width, height, 1,
- format, type, pixels)) {
+ if (!_mesa_validate_pbo_access(2, &ctx->Pack, width, height, 1,
+ format, type, bufSize, pixels)) {
+ if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
- "glReadPixels(invalid PBO access)");
- return;
+ "glReadPixels(out of bounds PBO access)");
+ } else {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glReadnPixelsARB(out of bounds access:"
+ " bufSize (%d) is too small)", bufSize);
}
+ return;
+ }
- if (_mesa_bufferobj_mapped(ctx->Pack.BufferObj)) {
- /* buffer is mapped - that's an error */
- _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(PBO is mapped)");
- return;
- }
+ if (_mesa_is_bufferobj(ctx->Pack.BufferObj) &&
+ _mesa_bufferobj_mapped(ctx->Pack.BufferObj)) {
+ /* buffer is mapped - that's an error */
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(PBO is mapped)");
+ return;
}
ctx->Driver.ReadPixels(ctx, x, y, width, height,
format, type, &ctx->Pack, pixels);
}
+
+void GLAPIENTRY
+_mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type, GLvoid *pixels )
+{
+ _mesa_ReadnPixelsARB(x, y, width, height, format, type, INT_MAX, pixels);
+}
|