mesa: fix GL_TEXTURE_INTERNAL_FORMAT query for compressed formats
authorBrian Paul <brianp@vmware.com>
Fri, 23 Oct 2009 20:40:40 +0000 (14:40 -0600)
committerBrian Paul <brianp@vmware.com>
Fri, 23 Oct 2009 20:45:44 +0000 (14:45 -0600)
Need to return the actual compressed format when the user originally
requested a generic compressed format.

src/mesa/main/texparam.c

index b2fbe2205ba591aa2c81f8f20b03d556c66938d4..9d1fdd0566402f33e76768284bf202b8546f12d8 100644 (file)
@@ -776,7 +776,15 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
          *params = img->Depth;
          break;
       case GL_TEXTURE_INTERNAL_FORMAT:
-         *params = img->InternalFormat;
+         if (img->IsCompressed) {
+            /* need to return the actual compressed format */
+            *params = _mesa_compressed_format_to_glenum(ctx,
+                                          img->TexFormat->MesaFormat);
+         }
+         else {
+            /* return the user's requested internal format */
+            *params = img->InternalFormat;
+         }
          break;
       case GL_TEXTURE_BORDER:
          *params = img->Border;