Bug 105901

Summary: Warn about mipmap-incomplete texture being used
Product: Mesa Reporter: Ruslan Kabatsayev <b7.10110111>
Component: OtherAssignee: mesa-dev
Status: RESOLVED MOVED QA Contact: mesa-dev
Severity: enhancement    
Priority: medium    
Version: 17.2   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Test program

Description Ruslan Kabatsayev 2018-04-05 07:26:56 UTC
Usage of textures with incomplete mipmap is a common OpenGL pitfall [1], since by default GL_TEXTURE_MIN_FILTER is GL_NEAREST_MIPMAP_LINEAR. Thus it'd be very useful if Mesa called debug callbacks on such errors.

A test case can be found in the attachment. When run, it first tries to draw a full-screen textured quad with a mipmap-incomplete texture, and on a key press it toggles TEXTURE_MIN_FILTER between NEAREST and NEAREST_MIPMAP_LINEAR.

Binary nvidia driver gives me a useful debug notification, leading to the following output from the test program on each frame with mipmap-incomplete texture use:

> debug callback called, notification: Texture state usage warning: Texture 1 has no mipmaps, while its min filter requires mipmap.

It would be very useful if Mesa also did this. Currently (as of 17.2) it doesn't emit any relevant messages.

[1]: https://www.opengl.org/archives/resources/features/KilgardTechniques/oglpitfall/
Comment 1 Ruslan Kabatsayev 2018-04-05 07:27:21 UTC
Created attachment 138612 [details]
Test program
Comment 2 Brian Paul 2018-04-05 13:34:38 UTC
With a debug build of Mesa if you set the MESA_DEBUG env var to "incomplete_tex" you'll get a warning.  This predates the GL_ARB_debug_output extension.

It shouldn't be hard to go into the incomplete() function in texobj.c and have it call _mesa_log_msg() so the incomplete texture gets reported via GL_ARB_debug_output.

Want to take a stab at it?

We should do the same for FBOs.
Comment 3 Ruslan Kabatsayev 2018-04-12 18:54:10 UTC
(In reply to Brian Paul from comment #2)
> Want to take a stab at it?
I might try if no one other does, but I'm not sure how soon I'll be able to do this.
Comment 4 Ilia Mirkin 2018-04-12 20:11:06 UTC
There's also an unfortunate extra case that's not even picked up by incomplete_tex here:

https://cgit.freedesktop.org/mesa/mesa/tree/src/mesa/main/texobj.h#n118

And this is actually the case being mentioned. The incomplete() stuff doesn't take sampler state into account.
Comment 5 GitLab Migration User 2019-09-18 20:18:29 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/924.

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.