mesa: don't compute the ModelView * Projection matrix if not used
Only GLSL built-in uniforms use it. This further reduces the time spent in _mesa_update_state. Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8850>
This commit is contained in:
parent
9f632df4b2
commit
10371c520c
|
@ -944,26 +944,6 @@ update_projection( struct gl_context *ctx )
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculate the combined modelview-projection matrix.
|
||||
*
|
||||
* \param ctx GL context.
|
||||
*
|
||||
* Multiplies the top matrices of the projection and model view stacks into
|
||||
* __struct gl_contextRec::_ModelProjectMatrix via _math_matrix_mul_matrix()
|
||||
* and analyzes the resulting matrix via _math_matrix_analyse().
|
||||
*/
|
||||
static void
|
||||
calculate_model_project_matrix( struct gl_context *ctx )
|
||||
{
|
||||
_math_matrix_mul_matrix( &ctx->_ModelProjectMatrix,
|
||||
ctx->ProjectionMatrixStack.Top,
|
||||
ctx->ModelviewMatrixStack.Top );
|
||||
|
||||
_math_matrix_analyse( &ctx->_ModelProjectMatrix );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates the combined modelview-projection matrix.
|
||||
*
|
||||
|
@ -983,10 +963,10 @@ void _mesa_update_modelview_project( struct gl_context *ctx, GLuint new_state )
|
|||
if (new_state & _NEW_PROJECTION)
|
||||
update_projection( ctx );
|
||||
|
||||
/* Keep ModelviewProject up to date always to allow tnl
|
||||
* implementations that go model->clip even when eye is required.
|
||||
*/
|
||||
calculate_model_project_matrix(ctx);
|
||||
/* Calculate ModelViewMatrix * ProjectionMatrix. */
|
||||
_math_matrix_mul_matrix(&ctx->_ModelProjectMatrix,
|
||||
ctx->ProjectionMatrixStack.Top,
|
||||
ctx->ModelviewMatrixStack.Top);
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
|
|
@ -297,7 +297,8 @@ fetch_state(struct gl_context *ctx, const gl_state_index16 state[],
|
|||
return;
|
||||
}
|
||||
case STATE_MVP_MATRIX_INVERSE: {
|
||||
const GLmatrix *matrix = &ctx->_ModelProjectMatrix;
|
||||
GLmatrix *matrix = &ctx->_ModelProjectMatrix;
|
||||
_math_matrix_analyse(matrix); /* make sure the inverse is up to date */
|
||||
copy_matrix(value, matrix->inv, state[2], state[3]);
|
||||
return;
|
||||
}
|
||||
|
@ -307,7 +308,8 @@ fetch_state(struct gl_context *ctx, const gl_state_index16 state[],
|
|||
return;
|
||||
}
|
||||
case STATE_MVP_MATRIX_INVTRANS: {
|
||||
const GLmatrix *matrix = &ctx->_ModelProjectMatrix;
|
||||
GLmatrix *matrix = &ctx->_ModelProjectMatrix;
|
||||
_math_matrix_analyse(matrix); /* make sure the inverse is up to date */
|
||||
copy_matrix_transposed(value, matrix->inv, state[2], state[3]);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue