Brian Paul <bri...@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 <e...@anholt.net>

Attachment: signature.asc
Description: PGP signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to