From c0a78d7d7b51e125d143e693fdfc78b90f2d68cf Mon Sep 17 00:00:00 2001 From: Anuj Phogat Date: Fri, 2 Nov 2012 10:47:33 -0700 Subject: [PATCH] mesa: Generate invalid operation in glGenerateMipMap for integer textures 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 Reviewed-by: Brian Paul --- src/mesa/main/fbobject.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index fc5681ccc05..2be61fb3c80 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -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++) -- 2.30.2