mesa: add MESA_DEBUG=fallback_tex

this is one of the most common sources of misrendering, and being able
to pinpoint it immediately solves a lot of issues

Acked-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37054>
This commit is contained in:
Mike Blumenkrantz 2025-08-28 08:18:40 -04:00 committed by Marge Bot
parent 5fde46f883
commit 1084fc6f4c
3 changed files with 6 additions and 2 deletions

View file

@ -205,7 +205,8 @@ set_debug_flags(const char *str)
{ "flush", DEBUG_ALWAYS_FLUSH }, /* flush after each drawing command */
{ "incomplete_tex", DEBUG_INCOMPLETE_TEXTURE },
{ "incomplete_fbo", DEBUG_INCOMPLETE_FBO },
{ "context", DEBUG_CONTEXT } /* force set GL_CONTEXT_FLAG_DEBUG_BIT flag */
{ "context", DEBUG_CONTEXT }, /* force set GL_CONTEXT_FLAG_DEBUG_BIT flag */
{ "fallback_tex", DEBUG_FALLBACK_TEXTURE },
};
GLuint i;

View file

@ -3680,7 +3680,8 @@ enum _debug
DEBUG_ALWAYS_FLUSH = (1 << 1),
DEBUG_INCOMPLETE_TEXTURE = (1 << 2),
DEBUG_INCOMPLETE_FBO = (1 << 3),
DEBUG_CONTEXT = (1 << 4)
DEBUG_CONTEXT = (1 << 4),
DEBUG_FALLBACK_TEXTURE = (1 << 5),
};
#ifdef __cplusplus

View file

@ -704,6 +704,8 @@ update_single_program_texture(struct gl_context *ctx, struct gl_program *prog,
* Mesa implements this by creating a hidden texture object with a pixel of
* that value.
*/
if (MESA_DEBUG_FLAGS & DEBUG_FALLBACK_TEXTURE)
_mesa_debug(NULL, "Using fallback texture for target %u\n", target_index);
texObj = _mesa_get_fallback_texture(ctx, target_index, !!(prog->ShadowSamplers & BITFIELD_BIT(unit)));
assert(texObj);