mesa: Generate invalid operation in glGenerateMipMap for integer textures
authorAnuj Phogat <anuj.phogat@gmail.com>
Fri, 2 Nov 2012 17:47:33 +0000 (10:47 -0700)
committerAnuj Phogat <anuj.phogat@gmail.com>
Mon, 5 Nov 2012 18:17:48 +0000 (10:17 -0800)
Khronos has reached a conclusion and disallowed following texture formats in
glGenerateMipMap():
 (a) ASTC textures
 (b) integer internal formats (e.g., RGBA8UI, RG16I)
 (c) textures with stencil formats (e.g., STENCIL_INDEX8)
 (d) textures with packed depth/stencil formats (e.g, DEPTH24_STENCIL8)

https://cvs.khronos.org/bugzilla/show_bug.cgi?id=9471

Note: This is a candidate for stable branches.
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/main/fbobject.c

index fc5681ccc05c60fb3ee590479e22a3bcf6579144..2be61fb3c805d7ecffb6a251be36df1f0b411d96 100644 (file)
@@ -2637,6 +2637,15 @@ _mesa_GenerateMipmapEXT(GLenum target)
       return;
    }
 
+   if (_mesa_is_enum_format_integer(srcImage->InternalFormat) ||
+       _mesa_is_depthstencil_format(srcImage->InternalFormat) ||
+       _mesa_is_stencil_format(srcImage->InternalFormat)) {
+      _mesa_unlock_texture(ctx, texObj);
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glGenerateMipmap(invalid internal format)");
+      return;
+   }
+
    if (target == GL_TEXTURE_CUBE_MAP) {
       GLuint face;
       for (face = 0; face < 6; face++)