From 92bd40b3fc3830028340969f2cc5c6a0720c4450 Mon Sep 17 00:00:00 2001 From: marha Date: Wed, 16 Jan 2013 08:28:39 +0100 Subject: libxtrans fontconfig glproto libX11 libXau libXext libXft libXinerama libXmu libfontenc mesa xkeyboard-config libxtrans: d9f3728ff74ceb956f6cf8dc24b38611f9a4868a fontconfig: ec5ca08c807585a9230f83c95f7cca6b7065b142 glproto: 8e3407e02980d088e20041e79bdcdd3737e7827e libX11: f57fd760cba92ad846917f21e94e73e9c846185f libXau: 1a8a1b2c68967b48c07b56142799b1020f017027 libXext: 8eee1236041d46a21faba32e0d27c26985267d89 libXft: c5e760a239afc62a1c75e0509868e35957c8df52 libXinerama: 470b9356af961ff7d3968b164aa73872b49a5dcc libXmu: 474d22468c90f99104873b4c5fd7b0f0d2cbf823 libfontenc: 0c3518df24192f18f15ce91c2868560a5973a3dc mesa: 3c00a52f7e02007f40fa53a06fad517bed0328ff xkeyboard-config: 8a117fbd4a029b952afcfe362931628dccf496e4 --- mesalib/src/mesa/main/teximage.c | 55 ++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 16 deletions(-) (limited to 'mesalib/src/mesa/main/teximage.c') diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index 7d3abb7e0..5e451e235 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -1893,23 +1893,30 @@ texture_error_check( struct gl_context *ctx, * requires GL_OES_texture_float) are filtered elsewhere. */ - if (_mesa_is_gles(ctx) && !_mesa_is_gles3(ctx)) { - if (format != internalFormat) { + if (_mesa_is_gles(ctx)) { + if (_mesa_is_gles3(ctx)) { + err = _mesa_es3_error_check_format_and_type(format, type, + internalFormat, + dimensions); + } else { + if (format != internalFormat) { _mesa_error(ctx, GL_INVALID_OPERATION, "glTexImage%dD(format = %s, internalFormat = %s)", dimensions, _mesa_lookup_enum_by_nr(format), _mesa_lookup_enum_by_nr(internalFormat)); return GL_TRUE; - } + } - err = _mesa_es_error_check_format_and_type(format, type, dimensions); + err = _mesa_es_error_check_format_and_type(format, type, dimensions); + } if (err != GL_NO_ERROR) { _mesa_error(ctx, err, - "glTexImage%dD(format = %s, type = %s)", + "glTexImage%dD(format = %s, type = %s, internalFormat = %s)", dimensions, _mesa_lookup_enum_by_nr(format), - _mesa_lookup_enum_by_nr(type)); + _mesa_lookup_enum_by_nr(type), + _mesa_lookup_enum_by_nr(internalFormat)); return GL_TRUE; } } @@ -2340,6 +2347,8 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions, GLint width, GLint height, GLint border ) { GLint baseFormat; + struct gl_renderbuffer *rb; + GLenum rb_internal_format; /* check target */ if (!legal_texsubimage_target(ctx, dimensions, target)) { @@ -2384,6 +2393,13 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions, return GL_TRUE; } + rb = _mesa_get_read_renderbuffer_for_format(ctx, internalFormat); + if (rb == NULL) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCopyTexImage%dD(read buffer)", dimensions); + return GL_TRUE; + } + /* OpenGL ES 1.x and OpenGL ES 2.0 impose additional restrictions on the * internalFormat. */ @@ -2409,6 +2425,8 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions, return GL_TRUE; } + rb_internal_format = rb->InternalFormat; + if (!_mesa_source_buffer_exists(ctx, baseFormat)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyTexImage%dD(missing readbuffer)", dimensions); @@ -2423,13 +2441,20 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions, * integer format and the read color buffer is an integer format." */ if (_mesa_is_color_format(internalFormat)) { - struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer; - - if (_mesa_is_enum_format_integer(rb->InternalFormat) != - _mesa_is_enum_format_integer(internalFormat)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glCopyTexImage%dD(integer vs non-integer)", dimensions); - return GL_TRUE; + bool is_int = _mesa_is_enum_format_integer(internalFormat); + bool is_rbint = _mesa_is_enum_format_integer(rb_internal_format); + if (is_int || is_rbint) { + if (is_int != is_rbint) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCopyTexImage%dD(integer vs non-integer)", dimensions); + return GL_TRUE; + } else if (_mesa_is_gles(ctx) && + _mesa_is_enum_format_unsigned_int(internalFormat) != + _mesa_is_enum_format_unsigned_int(rb_internal_format)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCopyTexImage%dD(signed vs unsigned integer)", dimensions); + return GL_TRUE; + } } } @@ -3340,9 +3365,7 @@ copyteximage(struct gl_context *ctx, GLuint dims, border, internalFormat, texFormat); /* Allocate texture memory (no pixel data yet) */ - ctx->Driver.TexImage(ctx, dims, texImage, - GL_NONE, GL_NONE, - NULL, &ctx->Unpack); + ctx->Driver.AllocTextureImageBuffer(ctx, texImage); if (_mesa_clip_copytexsubimage(ctx, &dstX, &dstY, &srcX, &srcY, &width, &height)) { -- cgit v1.2.3