mesa: only update fixed-func programs on texture matrix enablement changes

This should reduce fixed-func program key recomputations.

I also update the fixed-func fragment program, which was incorrectly
ignored because it's clearly used there.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
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:
Marek Olšák 2021-02-03 13:03:24 -05:00 committed by Marge Bot
parent 10c75ae41c
commit ec978e002f
3 changed files with 11 additions and 5 deletions

View file

@ -457,7 +457,7 @@ _mesa_update_state_locked( struct gl_context *ctx )
_mesa_update_modelview_project( ctx, new_state ); _mesa_update_modelview_project( ctx, new_state );
if (new_state & _NEW_TEXTURE_MATRIX) if (new_state & _NEW_TEXTURE_MATRIX)
_mesa_update_texture_matrices(ctx); new_state |= _mesa_update_texture_matrices(ctx);
if (new_state & (_NEW_TEXTURE_OBJECT | _NEW_TEXTURE_STATE | _NEW_PROGRAM)) if (new_state & (_NEW_TEXTURE_OBJECT | _NEW_TEXTURE_STATE | _NEW_PROGRAM))
new_state |= _mesa_update_texture_state(ctx); new_state |= _mesa_update_texture_state(ctx);
@ -493,8 +493,8 @@ _mesa_update_state_locked( struct gl_context *ctx )
} }
if (ctx->VertexProgram._UsesTnlProgram) { if (ctx->VertexProgram._UsesTnlProgram) {
prog_flags |= _NEW_FF_VERT_PROGRAM | _NEW_TEXTURE_MATRIX | prog_flags |= _NEW_FF_VERT_PROGRAM | _NEW_TRANSFORM | _NEW_POINT |
_NEW_TRANSFORM | _NEW_POINT | _NEW_FOG; _NEW_FOG;
} }
if (new_state & prog_flags) { if (new_state & prog_flags) {

View file

@ -387,10 +387,11 @@ _mesa_ClientActiveTexture(GLenum texture)
* *
* \param ctx GL context. * \param ctx GL context.
*/ */
void GLbitfield
_mesa_update_texture_matrices(struct gl_context *ctx) _mesa_update_texture_matrices(struct gl_context *ctx)
{ {
GLuint u; GLuint u;
GLbitfield old_texmat_enabled = ctx->Texture._TexMatEnabled;
ctx->Texture._TexMatEnabled = 0x0; ctx->Texture._TexMatEnabled = 0x0;
@ -404,6 +405,11 @@ _mesa_update_texture_matrices(struct gl_context *ctx)
ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(u); ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(u);
} }
} }
if (old_texmat_enabled != ctx->Texture._TexMatEnabled)
return _NEW_FF_VERT_PROGRAM | _NEW_FF_FRAG_PROGRAM;
return 0;
} }

View file

@ -109,7 +109,7 @@ _mesa_ClientActiveTexture( GLenum target );
*/ */
/*@{*/ /*@{*/
extern void extern GLbitfield
_mesa_update_texture_matrices(struct gl_context *ctx); _mesa_update_texture_matrices(struct gl_context *ctx);
extern GLbitfield extern GLbitfield