Bug 68250 - Automatic mipmap generation with texture compression produces borders that fade to black
Summary: Automatic mipmap generation with texture compression produces borders that fa...
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: 9.1
Hardware: All Linux (All)
: medium normal
Assignee: Kenneth Graunke
QA Contact:
Depends on:
Reported: 2013-08-19 00:57 UTC by Mak Nazecic-Andrlon
Modified: 2013-08-23 06:11 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:

Testcase (1.74 KB, text/plain)
2013-08-19 00:57 UTC, Mak Nazecic-Andrlon

Description Mak Nazecic-Andrlon 2013-08-19 00:57:15 UTC
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
Comment 1 Mak Nazecic-Andrlon 2013-08-19 01:10:04 UTC
Forgot to mention: the image produced in the the case should be ALL white. The gray border is a manifestation of the bug.
Comment 2 Mak Nazecic-Andrlon 2013-08-19 01:22:48 UTC
Also, it works fine gluBuild2DMipmaps().
Comment 3 Kenneth Graunke 2013-08-22 07:15:38 UTC
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.
Comment 4 Kenneth Graunke 2013-08-22 09:00:52 UTC
This should be fixed by the following Mesa patch:
Comment 5 Kenneth Graunke 2013-08-23 06:11:11 UTC
commit 62411681da4d1b7f9417f34dbf92a3e79e24dc09
Author: Kenneth Graunke <kenneth@whitecape.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.
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68250
    Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.