[Mesa-dev] [PATCH 3/4] st/mesa: ignore primitive restart if FixedIndex is enabled in DrawArraysIndirect

Marek Olšák maraeo at gmail.com
Sun Jan 4 14:35:07 PST 2015


Nice. BTW this patch is unrelated to the test. This patch tries to fix
the fixed index case, while the test only validates normal primitive
restart.

Marek

On Sun, Jan 4, 2015 at 10:54 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> FWIW the piglit you posted recently
> (arb_draw_indirect-draw-arrays-prim-restart) works with nvc0 with
> upstream mesa as-is. (But fails on llvmpipe/softpipe.)
>
> On Sun, Jan 4, 2015 at 4:44 PM, Marek Olšák <maraeo at gmail.com> wrote:
>> From: Marek Olšák <marek.olsak at amd.com>
>>
>> From GL 4.4 Core profile:
>>
>>   If both PRIMITIVE_RESTART and PRIMITIVE_RESTART_FIXED_INDEX are
>>   enabled, the index value determined by PRIMITIVE_RESTART_FIXED_INDEX is
>>   used. If PRIMITIVE_RESTART_FIXED_INDEX is enabled, primitive restart is not
>>   performed for array elements transferred by any drawing command not taking a
>>   type parameter, including all of the *Draw* commands other than *DrawEle-
>>   ments*.
>>
>> If only I had a driver where primitive restart works with DrawArraysIndirect.
>> I can't test this, sorry.
>> ---
>>  src/mesa/state_tracker/st_draw.c | 12 +++++++++---
>>  1 file changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
>> index b6ccdd7..9e5a5a9 100644
>> --- a/src/mesa/state_tracker/st_draw.c
>> +++ b/src/mesa/state_tracker/st_draw.c
>> @@ -248,9 +248,15 @@ st_draw_vbo(struct gl_context *ctx,
>>     if (indirect) {
>>        info.indirect = st_buffer_object(indirect)->buffer;
>>
>> -      /* Primitive restart is not handled by the VBO module in this case. */
>> -      info.primitive_restart = ctx->Array._PrimitiveRestart;
>> -      info.restart_index = ctx->Array.RestartIndex;
>> +      /* Primitive restart for DrawArrays is not handled by the VBO module
>> +       * in this case.
>> +       *
>> +       * If PrimitiveRestartFixedIndex is enabled, primitive_restart must
>> +       * be disabled for DrawArrays. DrawElements is handled above. */
>> +      if (!ib && !ctx->Array.PrimitiveRestartFixedIndex) {
>> +         info.primitive_restart = ctx->Array.PrimitiveRestart;
>> +         info.restart_index = ctx->Array.RestartIndex;
>> +      }
>>     }
>>
>>     /* do actual drawing */
>> --
>> 2.1.0
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list