Module: Mesa Branch: gles3 Commit: d22921cc1e74d1684993d03643a0615fcb780ce8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d22921cc1e74d1684993d03643a0615fcb780ce8
Author: Jordan Justen <[email protected]> Date: Fri Dec 28 11:00:50 2012 -0800 copyteximage: make sure is_srgb(src) == is_srgb(dst) v2: * Remove _EXT on enums * Remove compressed forms of sRGB from is_srgb_format * Add comment referencing GL Core spec Signed-off-by: Jordan Justen <[email protected]> --- src/mesa/main/teximage.c | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 5e451e2..12c9caf 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -2323,6 +2323,20 @@ texsubimage_error_check(struct gl_context *ctx, GLuint dimensions, } +static bool +is_srgb_format(GLenum internalFormat) +{ + switch (internalFormat) { + case GL_SRGB: + case GL_SRGB8: + case GL_SRGB_ALPHA: + case GL_SRGB8_ALPHA8: + return true; + default: + return false; + } +} + /** * Test glCopyTexImage[12]D() parameters for errors. * @@ -2426,6 +2440,24 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions, } rb_internal_format = rb->InternalFormat; + 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: + * + * "An INVALID_OPERATION error is generated under any of the + * following conditions: + * + * ... + * + * - if the value of FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING + * for the framebuffer attachment corresponding to the read + * buffer is SRGB and internalformat is not one of the sRGB + * formats. in table 8.23." + */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCopyTexImage%dD(srgb usage mismatch)", dimensions); + return GL_TRUE; + } if (!_mesa_source_buffer_exists(ctx, baseFormat)) { _mesa_error(ctx, GL_INVALID_OPERATION, _______________________________________________ mesa-commit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-commit
