diff options
author | Jordan Justen <[email protected]> | 2013-01-12 20:11:00 -0800 |
---|---|---|
committer | Matt Turner <[email protected]> | 2013-01-20 19:54:38 -0800 |
commit | a793ffa0b8b63afa014b3ed7f9febf38b4b0ea48 (patch) | |
tree | 6ff7ede1b4bede210200a9a248d103f9a4e5945b | |
parent | 3b51d71c8544ee198008bbf3545bf3def6e9e77f (diff) |
copyteximage: update error checking for GLES3
Changes based on GTF/gles3 conformance test suite.
Reviewed-by: Ian Romanick <[email protected]>
Signed-off-by: Jordan Justen <[email protected]>
-rw-r--r-- | src/mesa/main/teximage.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 1124b583650..7b84dd22e69 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -2348,6 +2348,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; @@ -2421,12 +2422,46 @@ 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 ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_framebuffer_object) || |