[Mesa-dev] [PATCH] gallium/u_vbuf: handle indirect multidraws correctly and efficiently (v3)

Marek Olšák maraeo at gmail.com
Thu Aug 2 18:37:16 UTC 2018


On Thu, Aug 2, 2018 at 1:54 PM, Eric Anholt <eric at anholt.net> wrote:
> Marek Olšák <maraeo at gmail.com> writes:
>
>> From: Marek Olšák <marek.olsak at amd.com>
>>
>> v2: need to do MAX{start+count} instead of MAX{count}
>>     added piglit tests
>> v3: use malloc
>> ---
>>  src/gallium/auxiliary/util/u_vbuf.c | 204 ++++++++++++++++++++++++----
>>  1 file changed, 180 insertions(+), 24 deletions(-)
>>
>> diff --git a/src/gallium/auxiliary/util/u_vbuf.c b/src/gallium/auxiliary/util/u_vbuf.c
>> index 746ff1085ce..a7a8a3be21b 100644
>> --- a/src/gallium/auxiliary/util/u_vbuf.c
>> +++ b/src/gallium/auxiliary/util/u_vbuf.c
>
>> -      new_info.count = data[0];
>> -      new_info.instance_count = data[1];
>> -      new_info.start = data[2];
>> -      pipe_buffer_unmap(pipe, transfer);
>> -      new_info.indirect = NULL;
>> -
>> -      if (!new_info.count)
>> +      if (!draw_count)
>>           return;
>> +
>> +      unsigned data_size = (draw_count - 1) * indirect->stride +
>> +                           (new_info.index_size ? 20 : 16);
>> +      unsigned *data = malloc(data_size);
>> +      if (!data)
>> +         return; /* report an error? */
>
> I think you can just _mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels");
> and then return.  With that, r-b.

Sadly, _mesa_error is not available in Gallium.

Marek


More information about the mesa-dev mailing list