[Mesa-dev] [PATCH 02/10] mesa: short-cut new_state == _NEW_LINE in _mesa_update_state_locked()

Eric Anholt eric at anholt.net
Wed Oct 14 17:57:58 PDT 2015


Brian Paul <brianp at vmware.com> writes:

> 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.
> ---
>  src/mesa/main/state.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
> index d3b1c72..7fa7da2 100644
> --- a/src/mesa/main/state.c
> +++ b/src/mesa/main/state.c
> @@ -392,7 +392,8 @@ _mesa_update_state_locked( struct gl_context *ctx )
>     GLbitfield prog_flags = _NEW_PROGRAM;
>     GLbitfield new_prog_state = 0x0;
>  
> -   if (new_state == _NEW_CURRENT_ATTRIB) 
> +   if (new_state == _NEW_CURRENT_ATTRIB ||
> +       new_state == _NEW_LINE)
>        goto out;

Perhaps something like:

GLbitfield computed_states = ~(_NEW_CURRENT_ATTRIB | _NEW_LINE);

if (!(new_state & computed_states))
   goto out;

making the optimization slightly more general and more self-documenting?
Either way, other than the comment on #7,

Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20151014/b59e1c8a/attachment-0001.sig>


More information about the mesa-dev mailing list