Mesa (master): tnl: Call _mesa_matrix_analyse to make sure the inverse MVP is updated
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Mar 1 21:31:40 UTC 2021
Module: Mesa
Branch: master
Commit: cb3dad8ca4d10d397466c0387bce97bc23cfaa26
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=cb3dad8ca4d10d397466c0387bce97bc23cfaa26
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Mon Mar 1 11:55:42 2021 -0800
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 <imirkin at alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9346>
---
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] );
More information about the mesa-commit
mailing list