Created attachment 84215 [details]
Using automatic mipmap generation with texture compression produces borders that fade to black, past a certain size, eventually disappearing entirely. The image gets cropped. This bug also appears to happen on Windows. This doesn't happen on NVIDIA or Mesa software rendering. Tried both S3TC and the generic compression. SDL-based testcase attached.
Automatic mipmap generation works. Texture compression works. The combination of the two produces artifacts.
The testcase was ran on Ubuntu 13.04. I do have libtxc_dxtn installed.
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Sandybridge Mobile x86/MMX/SSE2
OpenGL version string: 3.0 Mesa 9.1.3
OpenGL shading language version string: 1.30
Forgot to mention: the image produced in the the case should be ALL white. The gray border is a manifestation of the bug.
Also, it works fine gluBuild2DMipmaps().
Some initial investigation:
Looks like the ctx->Driver.GetTexImage() call in generate_mipmap_compressed at mipmap.c:2079 is giving us the bogus black pixels.
This should be fixed by the following Mesa patch:
Author: Kenneth Graunke <firstname.lastname@example.org>
Date: Thu Aug 22 01:29:11 2013 -0700
meta: Set correct viewport and projection in decompress_texture_image.
_mesa_meta_begin() sets up an orthographic project and initializes the
viewport based on the current drawbuffer's width and height. This is
likely the window size, since it occurs before the meta operation binds
any temporary buffers.
decompress_texture_image needs the viewport to be the size of the image
it's trying to draw. Otherwise, it may only draw part of the image.
v2: Actually set the projection properly too.
Signed-off-by: Kenneth Graunke <email@example.com>
on Oct 28, 2016 at 17:46:43.
(provided by the Example extension).