Mesa (master): mesa: short-cut new_state == _NEW_LINE in _mesa_update_state_locked()

Brian Paul brianp at kemper.freedesktop.org
Thu Oct 15 13:23:09 UTC 2015


Module: Mesa
Branch: master
Commit: 083b3f5cb4c5bd701d6a371282d7dc8c4f5fcaa8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=083b3f5cb4c5bd701d6a371282d7dc8c4f5fcaa8

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Oct 14 09:10:19 2015 -0600

mesa: short-cut new_state == _NEW_LINE in _mesa_update_state_locked()

We can skip to the end of _mesa_update_state_locked() if only the
_NEW_LINE flag is set since none of the derived state depends on it
(just like _NEW_CURRENT_ATTRIB).  Note that we still call the
ctx->Driver.UpdateState() function, of course.

v2: use bitmask-based test, per Eric.

Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/mesa/main/state.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index d3b1c72..4043c4f 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -391,8 +391,12 @@ _mesa_update_state_locked( struct gl_context *ctx )
    GLbitfield new_state = ctx->NewState;
    GLbitfield prog_flags = _NEW_PROGRAM;
    GLbitfield new_prog_state = 0x0;
+   const GLbitfield computed_states = ~(_NEW_CURRENT_ATTRIB | _NEW_LINE);
 
-   if (new_state == _NEW_CURRENT_ATTRIB) 
+   /* 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)
       goto out;
 
    if (MESA_VERBOSE & VERBOSE_STATE)




More information about the mesa-commit mailing list