From e4868cd1c47141654cd87fa5ecf3047154973be6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 1 Feb 2021 00:48:03 -0500 Subject: [PATCH] mesa: move fixed-func-related _mesa_update_state code closer together Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/mesa/main/state.c | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 2335a08437e..7b32a091d74 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -452,28 +452,7 @@ _mesa_update_state_locked( struct gl_context *ctx ) /* Handle Core and Compatibility contexts separately. */ if (ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGLES) { - GLbitfield prog_flags = _NEW_PROGRAM; - - if (new_state & _NEW_PROGRAM) - update_fixed_func_program_usage(ctx); - - /* Determine which states affect fixed-func vertex/fragment program. */ - if (ctx->FragmentProgram._UsesTexEnvProgram) { - prog_flags |= (_NEW_BUFFERS | _NEW_TEXTURE_OBJECT | _NEW_FOG | - _NEW_VARYING_VP_INPUTS | _NEW_LIGHT | _NEW_POINT | - _NEW_RENDERMODE | _NEW_COLOR | _NEW_TEXTURE_STATE); - } - - if (ctx->VertexProgram._UsesTnlProgram) { - prog_flags |= (_NEW_VARYING_VP_INPUTS | _NEW_TEXTURE_OBJECT | - _NEW_TEXTURE_MATRIX | _NEW_TRANSFORM | _NEW_POINT | - _NEW_FOG | _NEW_LIGHT | _NEW_TEXTURE_STATE | - _MESA_NEW_NEED_EYE_COORDS); - } - - /* - * Now update derived state info - */ + /* Update derived state. */ if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION)) _mesa_update_modelview_project( ctx, new_state ); @@ -501,6 +480,25 @@ _mesa_update_state_locked( struct gl_context *ctx ) if (new_state & _MESA_NEW_NEED_EYE_COORDS) _mesa_update_tnl_spaces( ctx, new_state ); + if (new_state & _NEW_PROGRAM) + update_fixed_func_program_usage(ctx); + + /* Determine which states affect fixed-func vertex/fragment program. */ + GLbitfield prog_flags = _NEW_PROGRAM; + + if (ctx->FragmentProgram._UsesTexEnvProgram) { + prog_flags |= _NEW_BUFFERS | _NEW_TEXTURE_OBJECT | _NEW_FOG | + _NEW_VARYING_VP_INPUTS | _NEW_LIGHT | _NEW_POINT | + _NEW_RENDERMODE | _NEW_COLOR | _NEW_TEXTURE_STATE; + } + + if (ctx->VertexProgram._UsesTnlProgram) { + prog_flags |= _NEW_VARYING_VP_INPUTS | _NEW_TEXTURE_OBJECT | + _NEW_TEXTURE_MATRIX | _NEW_TRANSFORM | _NEW_POINT | + _NEW_FOG | _NEW_LIGHT | _NEW_TEXTURE_STATE | + _MESA_NEW_NEED_EYE_COORDS; + } + if (new_state & prog_flags) { /* When we generate programs from fixed-function vertex/fragment state * this call may generate/bind a new program. If so, we need to