diff options
author | marha <marha@users.sourceforge.net> | 2013-01-22 14:07:34 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-01-22 14:07:34 +0100 |
commit | 470f7ca9f0be348faf2f03fc16811844c5eeffce (patch) | |
tree | 3071ab9b9fbabc772ee68c86fe587f260bde26c6 /mesalib/src/mesa/main/readpix.c | |
parent | 4fc6b34d1c14cc61f553ca59264d0909656933f3 (diff) | |
download | vcxsrv-470f7ca9f0be348faf2f03fc16811844c5eeffce.tar.gz vcxsrv-470f7ca9f0be348faf2f03fc16811844c5eeffce.tar.bz2 vcxsrv-470f7ca9f0be348faf2f03fc16811844c5eeffce.zip |
fontconfig libfontenc mesa mkfontscale pixman xserver xkeyboard-config
fontconfig: 000ca9ccb03013a5b151f0d21148ab0ca4c2f2de
libfontenc: f5d1208172e965fdd7fae8927bd3e29b3cc3a975
mesa: 148fc6d53716f39971a453792570c2b8c207efb6
mkfontscale: 547517571e695728278a264eedbac47b6e1f43bc
pixman: 2c6577476e5b18e17904ae8af244a39c352e2e33
xserver: 70b127c9f1c53bdb42f078265e67f76b464deae2
xkeyboard-config: 6b35b1b43d2fdff30f530d7cf65fffd6c3504690
Diffstat (limited to 'mesalib/src/mesa/main/readpix.c')
-rw-r--r-- | mesalib/src/mesa/main/readpix.c | 85 |
1 files changed, 74 insertions, 11 deletions
diff --git a/mesalib/src/mesa/main/readpix.c b/mesalib/src/mesa/main/readpix.c index 5b80e9a8b..2f130ae9a 100644 --- a/mesalib/src/mesa/main/readpix.c +++ b/mesalib/src/mesa/main/readpix.c @@ -674,16 +674,65 @@ _mesa_readpixels(struct gl_context *ctx, } +static GLenum +read_pixels_es3_error_check(GLenum format, GLenum type, + const struct gl_renderbuffer *rb) +{ + const GLenum internalFormat = rb->InternalFormat; + const GLenum data_type = _mesa_get_format_datatype(rb->Format); + GLboolean is_unsigned_int = GL_FALSE; + GLboolean is_signed_int = GL_FALSE; + + if (!_mesa_is_color_format(internalFormat)) { + return GL_INVALID_OPERATION; + } + + is_unsigned_int = _mesa_is_enum_format_unsigned_int(internalFormat); + if (!is_unsigned_int) { + is_signed_int = _mesa_is_enum_format_signed_int(internalFormat); + } + + switch (format) { + case GL_RGBA: + if (type == GL_FLOAT && data_type == GL_FLOAT) + return GL_NO_ERROR; /* EXT_color_buffer_float */ + if (type == GL_UNSIGNED_BYTE && data_type == GL_UNSIGNED_NORMALIZED) + return GL_NO_ERROR; + if (internalFormat == GL_RGB10_A2 && + type == GL_UNSIGNED_INT_2_10_10_10_REV) + return GL_NO_ERROR; + if (internalFormat == GL_RGB10_A2UI && type == GL_UNSIGNED_BYTE) + return GL_NO_ERROR; + break; + case GL_BGRA: + /* GL_EXT_read_format_bgra */ + if (type == GL_UNSIGNED_BYTE || + type == GL_UNSIGNED_SHORT_4_4_4_4_REV || + type == GL_UNSIGNED_SHORT_1_5_5_5_REV) + return GL_NO_ERROR; + break; + case GL_RGBA_INTEGER: + if ((is_signed_int && type == GL_INT) || + (is_unsigned_int && type == GL_UNSIGNED_INT)) + return GL_NO_ERROR; + break; + } + + return GL_INVALID_OPERATION; +} + + void GLAPIENTRY _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *pixels ) { GLenum err = GL_NO_ERROR; + struct gl_renderbuffer *rb; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_VERTICES(ctx, 0); FLUSH_CURRENT(ctx, 0); if (MESA_VERBOSE & VERBOSE_API) @@ -699,6 +748,22 @@ _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, + "glReadPixels(read buffer)"); + return; + } + /* OpenGL ES 1.x and OpenGL ES 2.0 impose additional restrictions on the * combinations of format and type that can be used. * @@ -708,13 +773,20 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height, * combination is, and Mesa can handle anything valid. Just work instead. */ if (_mesa_is_gles(ctx)) { - if (ctx->Version < 30) { + if (ctx->API == API_OPENGLES2 && + _mesa_is_color_format(format) && + _mesa_get_color_read_format(ctx) == format && + _mesa_get_color_read_type(ctx) == type) { + err = GL_NO_ERROR; + } else if (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 { + err = read_pixels_es3_error_check(format, type, rb); } if (err == GL_NO_ERROR && (format == GL_DEPTH_COMPONENT @@ -730,9 +802,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)", @@ -741,12 +810,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)"); |