On 01/04/2013 06:41 PM, Jordan Justen wrote:
Signed-off-by: Jordan Justen <[email protected]>
---
src/mesa/main/teximage.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index ac60a21..169e768 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -2323,6 +2323,29 @@ texsubimage_error_check(struct gl_context *ctx, GLuint
dimensions,
}
+static bool
+is_srgb_format(GLenum internalFormat)
+{
+ switch (internalFormat) {
+ case GL_SRGB_EXT:
+ case GL_SRGB8_EXT:
+ case GL_COMPRESSED_SRGB_EXT:
+ case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
+ case GL_SRGB_ALPHA_EXT:
+ case GL_SRGB8_ALPHA8_EXT:
+ case GL_COMPRESSED_SRGB_ALPHA_EXT:
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
Also, drop _EXT in the cases that can.
+ case GL_COMPRESSED_SRGB8_ETC2:
+ case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
+ case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
Eh... you can't specify the compressed formats as internalformat, and
that won't be format of the read-buffer either. Right?
+ return true;
+ default:
+ return false;
+ }
+}
+
/**
* Test glCopyTexImage[12]D() parameters for errors.
*
@@ -2416,6 +2439,12 @@ copytexture_error_check( struct gl_context *ctx, GLuint
dimensions,
return GL_TRUE;
}
It makes sense, but I didn't realize it was supposed to be an error. Is
there a similar error for TexImage? Could you add this spec reference here:
/* 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."
*/
+ if (is_srgb_format(internalFormat) != is_srgb_format(rb_internal_format)) {
+ _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,
"glCopyTexImage%dD(missing readbuffer)", dimensions);
_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev