On Tue, May 1, 2012 at 2:07 PM, Brian Paul <span dir="ltr"><<a href="mailto:brianp@vmware.com" target="_blank">brianp@vmware.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
When glTexImage or glCopyTexImage is called with internalFormat being a<br>
generic compressed format (like GL_COMPRESSED_RGB) we need to do the same<br>
error checks as for specific compressed formats. In particular, check if<br>
the texture target is compatible with the format. None of the texture<br>
compression formats we support so far work with GL_TEXTURE_1D, for example.<br>
<br>
See also <a href="https://bugs.freedesktop.org/show_bug.cgi?id=49124" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=49124</a></blockquote><div><br></div><div>Brian, generic texture compression formats with GL_TEXTURE_1D seem to work fine</div>
<div>on i965 drivers. I verified this by allowing generic texture compression formats for</div><div>GL_TEXTURE_1D in piglit copyteximage test case and reverting the changes due to</div><div>this patch on mesa. Is this an issue only on swrast? Returning GL_INVALID_ENUM</div>
<div>error for generic texture compression formats in glTexImage1D() and</div><div>glCopyTexImage1D() doesn't seem to follow the OpenGL specification. Spec does allow</div><div>GL_INVALID_ENUM error for a similar scenario in case of glCompressedTexImage1D().</div>
<div>Please correct me if I'm missing something. </div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
NOTE: This is a candidate for the 8.0 branch.<br>
---<br>
src/mesa/main/teximage.c | 32 ++++++++++++++++++++++++++++++--<br>
1 files changed, 30 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c<br>
index 50095d2..694f6fa 100644<br>
--- a/src/mesa/main/teximage.c<br>
+++ b/src/mesa/main/teximage.c<br>
@@ -531,6 +531,32 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )<br>
<br>
<br>
/**<br>
+ * Is the given texture format a generic compressed format?<br>
+ */<br>
+static GLboolean<br>
+is_generic_compressed_format(GLenum format)<br>
+{<br>
+ switch (format) {<br>
+ case GL_COMPRESSED_RED:<br>
+ case GL_COMPRESSED_RG:<br>
+ case GL_COMPRESSED_RGB:<br>
+ case GL_COMPRESSED_RGBA:<br>
+ case GL_COMPRESSED_ALPHA:<br>
+ case GL_COMPRESSED_LUMINANCE:<br>
+ case GL_COMPRESSED_LUMINANCE_ALPHA:<br>
+ case GL_COMPRESSED_INTENSITY:<br>
+ case GL_COMPRESSED_SRGB:<br>
+ case GL_COMPRESSED_SRGB_ALPHA:<br>
+ case GL_COMPRESSED_SLUMINANCE:<br>
+ case GL_COMPRESSED_SLUMINANCE_ALPHA:<br>
+ return GL_TRUE;<br>
+ default:<br>
+ return GL_FALSE;<br>
+ }<br>
+}<br>
+<br>
+<br>
+/**<br>
* For cube map faces, return a face index in [0,5].<br>
* For other targets return 0;<br>
*/<br>
@@ -1705,7 +1731,8 @@ texture_error_check( struct gl_context *ctx,<br>
}<br>
<br>
/* additional checks for compressed textures */<br>
- if (_mesa_is_compressed_format(ctx, internalFormat)) {<br>
+ if (_mesa_is_compressed_format(ctx, internalFormat) ||<br>
+ is_generic_compressed_format(internalFormat)) {<br>
if (!target_can_be_compressed(ctx, target, internalFormat)) {<br>
if (!isProxy)<br>
_mesa_error(ctx, GL_INVALID_ENUM,<br>
@@ -2036,7 +2063,8 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions,<br>
return GL_TRUE;<br>
}<br>
<br>
- if (_mesa_is_compressed_format(ctx, internalFormat)) {<br>
+ if (_mesa_is_compressed_format(ctx, internalFormat) ||<br>
+ is_generic_compressed_format(internalFormat)) {<br>
if (!target_can_be_compressed(ctx, target, internalFormat)) {<br>
_mesa_error(ctx, GL_INVALID_ENUM,<br>
"glCopyTexImage%dD(target)", dimensions);<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.3.4<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br>