From cb3dad8ca4d10d397466c0387bce97bc23cfaa26 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 1 Mar 2021 11:55:42 -0800 Subject: [PATCH] tnl: Call _mesa_matrix_analyse to make sure the inverse MVP is updated A recent commit stopped updating the inverse MVP matrix, because usually only GLSL built-ins need it. However, TNL also needs it. So make sure it's correct when needed. Fixes: 10371c520c1 ("mesa: don't compute the ModelView * Projection matrix if not used") Reviewed-by: Ilia Mirkin Part-of: --- src/mesa/tnl/t_vb_program.c | 3 +++ src/mesa/tnl/t_vb_vertex.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c index f240e98387f..44fc63ad3ef 100644 --- a/src/mesa/tnl/t_vb_program.c +++ b/src/mesa/tnl/t_vb_program.c @@ -402,6 +402,9 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) unmap_textures(ctx, program); if (program->arb.IsPositionInvariant) { + /* make sure the inverse is up to date */ + _math_matrix_analyse(&ctx->_ModelProjectMatrix); + /* We need the exact same transform as in the fixed function path here * to guarantee invariance, depending on compiler optimization flags * results could be different otherwise. diff --git a/src/mesa/tnl/t_vb_vertex.c b/src/mesa/tnl/t_vb_vertex.c index 1309b465b78..60c624d77a7 100644 --- a/src/mesa/tnl/t_vb_vertex.c +++ b/src/mesa/tnl/t_vb_vertex.c @@ -158,6 +158,9 @@ static GLboolean run_vertex_stage( struct gl_context *ctx, VB->AttribPtr[_TNL_ATTRIB_POS]); } + /* make sure the inverse is up to date */ + _math_matrix_analyse(&ctx->_ModelProjectMatrix); + VB->ClipPtr = TransformRaw( &store->clip, &ctx->_ModelProjectMatrix, VB->AttribPtr[_TNL_ATTRIB_POS] );