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

Roland Scheidegger sroland at vmware.com
Mon Jan 5 08:48:01 PST 2015


I'm wondering how this is supposed to work with draw (and draw_info in
general). Looks like draw will not do prim restart for non-indexed calls
- d3d10 apparently works like the FIXED_INDEX case of gl (so, arrays
won't trigger restarts). I wasn't even aware that GL triggers restarts
for DrawArray calls, seems kind of weird to match the restart value to
some internally made up index value but OTOH seems quite logical given
how GL specifies "transfer of elements".
So I guess it's not too surprising it doesn't work with
softpipe/llvmpipe, I wonder though if it's even worth fixing is there
some real use case for this?

Roland


Am 04.01.2015 um 22:54 schrieb Ilia Mirkin:
> 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
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I&m=rvLOxUPLSGChCFNVoFytPnc_7pF8bgBud0q2JPjDZMk&s=x9uQzkxQx-Bod7Rt1mfsUdmELyQjhMx0HeBzyjOPDzw&e= 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I&m=rvLOxUPLSGChCFNVoFytPnc_7pF8bgBud0q2JPjDZMk&s=x9uQzkxQx-Bod7Rt1mfsUdmELyQjhMx0HeBzyjOPDzw&e= 
> 



More information about the mesa-dev mailing list