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

Brian Paul brianp at vmware.com
Thu Oct 15 06:20:24 PDT 2015


On 10/14/2015 06:57 PM, Eric Anholt wrote:
> 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?

Good idea.  I'll fix that before committing.

-Brian


> Either way, other than the comment on #7,
>
> Reviewed-by: Eric Anholt <eric at anholt.net>
>



More information about the mesa-dev mailing list