diff options
author | marha <marha@users.sourceforge.net> | 2012-08-31 15:18:29 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-08-31 15:18:29 +0200 |
commit | 53192e17e55aa9ed3e3721bf4fdcb2b01a595202 (patch) | |
tree | 01d81bc7cfb5dc92584f4b7615d2ac1b09fe5411 /mesalib/src/mesa/main/readpix.c | |
parent | 05d67ae9117e5157fd1a5175dde6d7e48caf4653 (diff) | |
download | vcxsrv-53192e17e55aa9ed3e3721bf4fdcb2b01a595202.tar.gz vcxsrv-53192e17e55aa9ed3e3721bf4fdcb2b01a595202.tar.bz2 vcxsrv-53192e17e55aa9ed3e3721bf4fdcb2b01a595202.zip |
randrproto xwininfo fontconfig libxcb mesa xkeyboard-config pixman xserver
git update 31 Aug 2012
Diffstat (limited to 'mesalib/src/mesa/main/readpix.c')
-rw-r--r-- | mesalib/src/mesa/main/readpix.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/mesalib/src/mesa/main/readpix.c b/mesalib/src/mesa/main/readpix.c index f0bc157d8..7dc758152 100644 --- a/mesalib/src/mesa/main/readpix.c +++ b/mesalib/src/mesa/main/readpix.c @@ -38,7 +38,13 @@ #include "state.h" #include "glformats.h" #include "fbobject.h" +#include "teximage.h" +/* Inexplicably, GL_HALF_FLOAT_OES has a different value than GL_HALF_FLOAT. + */ +#ifndef GL_HALF_FLOAT_OES +#define GL_HALF_FLOAT_OES 0x8D61 +#endif /** * Tries to implement glReadPixels() of GL_DEPTH_COMPONENT using memcpy of the @@ -699,6 +705,33 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height, return; } + /* OpenGL ES 1.x and OpenGL ES 2.0 impose additional restrictions on the + * combinations of format and type that can be used. + * + * Technically, only two combinations are actually allowed: + * GL_RGBA/GL_UNSIGNED_BYTE, and some implementation-specific internal + * preferred combination. This code doesn't know what that preferred + * combination is, and Mesa can handle anything valid. Just work instead. + */ + if (_mesa_is_gles(ctx) && ctx->Version < 30) { + err = _mesa_es_error_check_format_and_type(format, type, 2); + if (err == GL_NO_ERROR) { + if (type == GL_FLOAT || type == GL_HALF_FLOAT_OES) { + err = GL_INVALID_OPERATION; + } else if (format == GL_DEPTH_COMPONENT + || format == GL_DEPTH_STENCIL) { + err = GL_INVALID_ENUM; + } + } + + if (err != GL_NO_ERROR) { + _mesa_error(ctx, err, "glReadPixels(invalid format %s and/or type %s)", + _mesa_lookup_enum_by_nr(format), + _mesa_lookup_enum_by_nr(type)); + return; + } + } + if (ctx->NewState) _mesa_update_state(ctx); |