Module: Mesa Branch: gles3 Commit: 1e6e012c07be9427da1971fd0203a6a2c6e02812 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1e6e012c07be9427da1971fd0203a6a2c6e02812
Author: Jordan Justen <[email protected]> Date: Fri Dec 28 11:07:01 2012 -0800 copyteximage: update error checking for GLES3 Changes based on GTF/gles3 conformance test suite. Signed-off-by: Jordan Justen <[email protected]> --- src/mesa/main/teximage.c | 38 +++++++++++++++++++++++++++++++++++++- 1 files changed, 37 insertions(+), 1 deletions(-) diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 12c9caf..eeb977e 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -2361,6 +2361,7 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions, GLint width, GLint height, GLint border ) { GLint baseFormat; + GLint rb_base_format; struct gl_renderbuffer *rb; GLenum rb_internal_format; @@ -2434,12 +2435,47 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions, baseFormat = _mesa_base_tex_format(ctx, internalFormat); if (baseFormat < 0) { - _mesa_error(ctx, GL_INVALID_VALUE, + _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyTexImage%dD(internalFormat)", dimensions); return GL_TRUE; } rb_internal_format = rb->InternalFormat; + rb_base_format = _mesa_base_tex_format(ctx, rb->InternalFormat); + if (_mesa_is_color_format(internalFormat)) { + if (rb_base_format < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexImage%dD(internalFormat)", dimensions); + return GL_TRUE; + } + } + + if (_mesa_is_gles(ctx)) { + bool valid = true; + if (_mesa_base_format_component_count(baseFormat) > + _mesa_base_format_component_count(rb_base_format)) { + valid = false; + } + if (baseFormat == GL_DEPTH_COMPONENT || + baseFormat == GL_DEPTH_STENCIL || + rb_base_format == GL_DEPTH_COMPONENT || + rb_base_format == GL_DEPTH_STENCIL || + ((baseFormat == GL_LUMINANCE_ALPHA || + baseFormat == GL_ALPHA) && + rb_base_format != GL_RGBA) || + internalFormat == GL_RGB9_E5) { + valid = false; + } + if (internalFormat == GL_RGB9_E5) { + valid = false; + } + if (!valid) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCopyTexImage%dD(internalFormat)", dimensions); + return GL_TRUE; + } + } + if (is_srgb_format(internalFormat) != is_srgb_format(rb_internal_format)) { /* Page 190 (page 211 of the PDF) in section 8.6 of the OpenGL 4.3 * Core Profile spec says: _______________________________________________ mesa-commit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-commit
