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

Kenneth Graunke kenneth at whitecape.org
Tue May 28 18:34:30 PDT 2013


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?

--Ken


More information about the mesa-dev mailing list