From b0047be0c253d1fdaf8ba015704deb5380ce7fc3 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Mon, 17 Nov 2025 15:13:14 +1100 Subject: [PATCH] mesa: fix _mesa_update_texture_matrices() _math_matrix_is_dirty() should only be used to decide if we need to run _math_matrix_analyse(). We already decided that we had a new texture matrix when we called _mesa_update_texture_matrices() so we need to set _TexMatEnabled correctly otherwise we might incorrectly return _NEW_FF_VERT_PROGRAM | _NEW_FF_FRAG_PROGRAM in the following if-statement. Fixes: ec978e002f59 ("mesa: only update fixed-func programs on texture matrix enablement changes") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14286 Reviewed-by: Emma Anholt Part-of: --- src/mesa/main/texstate.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 9917d6730ad..b8746a2cac8 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -401,12 +401,12 @@ _mesa_update_texture_matrices(struct gl_context *ctx) for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) { assert(u < ARRAY_SIZE(ctx->TextureMatrixStack)); if (_math_matrix_is_dirty(ctx->TextureMatrixStack[u].Top)) { - _math_matrix_analyse( ctx->TextureMatrixStack[u].Top ); - - if (ctx->Texture.Unit[u]._Current && - ctx->TextureMatrixStack[u].Top->type != MATRIX_IDENTITY) - ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(u); + _math_matrix_analyse(ctx->TextureMatrixStack[u].Top); } + + if (ctx->Texture.Unit[u]._Current && + ctx->TextureMatrixStack[u].Top->type != MATRIX_IDENTITY) + ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(u); } if (old_texmat_enabled != ctx->Texture._TexMatEnabled)