From f8c4c46cd3b9b806c854770af7e4807032893180 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 3 Feb 2021 02:40:59 -0500 Subject: [PATCH] mesa: skip a subset of _mesa_update_state if no relevant flags are set MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit We only need to check 12 out of 32 flags. Reviewed-by: Zoltán Böszörményi Acked-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/mesa/main/state.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index e184338..38fd54e 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -435,12 +435,16 @@ _mesa_update_state_locked( struct gl_context *ctx ) { GLbitfield new_state = ctx->NewState; GLbitfield new_prog_state = 0x0; - const GLbitfield computed_states = ~(_NEW_CURRENT_ATTRIB | _NEW_LINE); + const GLbitfield checked_states = + _NEW_BUFFERS | _NEW_MODELVIEW | _NEW_PROJECTION | _NEW_TEXTURE_MATRIX | + _NEW_TEXTURE_OBJECT | _NEW_TEXTURE_STATE | _NEW_PROGRAM | + _NEW_LIGHT_CONSTANTS | _NEW_POINT | _NEW_FF_VERT_PROGRAM | + _NEW_FF_FRAG_PROGRAM | _NEW_TNL_SPACES; /* we can skip a bunch of state validation checks if the dirty * state matches one or more bits in 'computed_states'. */ - if ((new_state & computed_states) == 0) + if (!(new_state & checked_states)) goto out; if (MESA_VERBOSE & VERBOSE_STATE) -- 2.7.4