tnl: Call _mesa_matrix_analyse to make sure the inverse MVP is updated
authorKenneth Graunke <kenneth@whitecape.org>
Mon, 1 Mar 2021 19:55:42 +0000 (11:55 -0800)
committerMarge Bot <eric+marge@anholt.net>
Mon, 1 Mar 2021 21:11:47 +0000 (21:11 +0000)
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 <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9346>

src/mesa/tnl/t_vb_program.c
src/mesa/tnl/t_vb_vertex.c

index f240e98..44fc63a 100644 (file)
@@ -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.
index 1309b46..60c624d 100644 (file)
@@ -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] );