[Mesa-dev] [PATCH 8/8] mesa: Delete the ctx->Array._RestartIndex derived state.

Eric Anholt eric at anholt.net
Tue May 28 22:54:36 PDT 2013


Kenneth Graunke <kenneth at whitecape.org> writes:

> On 05/28/2013 04:06 PM, Eric Anholt wrote:
>> Kenneth Graunke <kenneth at whitecape.org> writes:
>>> diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
>>> index dff0070..5f10f0c 100644
>>> --- a/src/mesa/main/varray.c
>>> +++ b/src/mesa/main/varray.c
>>> @@ -1110,9 +1110,8 @@ _mesa_PrimitiveRestartIndex(GLuint index)
>>>      }
>>>
>>>      ctx->Array.RestartIndex = index;
>>> -   if (ctx->Array.PrimitiveRestart && ctx->Array._RestartIndex != index) {
>>> +   if (ctx->Array.PrimitiveRestart && ctx->Array.RestartIndex != index) {
>>>         FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
>>> -      ctx->Array._RestartIndex = index;
>>>      }
>>>   }
>>
>> I don't think your conditional will ever trigger now.  I think you want
>> to just move the "ctx->Array.RestartIndex = index" inside the block, so
>> that previously-queued drawing is successfully flushed with the old
>> restart index, not the new one.
>>
>> Other than that, this series is:
>>
>> Reviewed-by: Eric Anholt <eric at anholt.net>
>
> Oops...you're right, of course.  What I meant was:
>
>     if (ctx->Array.PrimitiveRestart && ctx->Array.RestartIndex != index)
>        FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
>
>     ctx->Array.RestartIndex = index;
>
> This avoids the flush/state flagging when GL-style primitive restart is 
> disabled, since in that case the restart index is irrelevant.  Notably, 
> changing either ctx->Array.PrimitiveRestart or 
> ctx->Array.PrimitiveRestartFixedIndex flushes vertices with 
> _NEW_TRANSFORM, so it ought to work.
>
> Or I could just go back to what we had before Ian's patch:
>
> if (ctx->Array.RestartIndex != index) {
>     FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
>     ctx->Array.RestartIndex = index;
> }
>
> which is obvious and simple.  Which would you prefer?

Second, because that way you don't lose the update to RestartIndex if
restart is disabled at the moment. :)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130528/784a2dac/attachment.pgp>


More information about the mesa-dev mailing list