gallium/u_threaded: skip draws if user index buffer size has size == 0

This happens when all draws have count == 0.

Fixes: 85b6ba136b "st/mesa: implement Driver.DrawGallium callbacks

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8345>
This commit is contained in:
Marek Olšák 2021-01-05 23:14:55 -05:00 committed by Marge Bot
parent c69b8fd651
commit be50c7f329

View file

@ -2401,6 +2401,9 @@ tc_draw_vbo(struct pipe_context *_pipe, const struct pipe_draw_info *info,
struct pipe_resource *buffer = NULL;
unsigned offset;
if (!size)
return;
/* This must be done before adding draw_vbo, because it could generate
* e.g. transfer_unmap and flush partially-uninitialized draw_vbo
* to the driver if it was done afterwards.
@ -2445,6 +2448,9 @@ tc_draw_vbo(struct pipe_context *_pipe, const struct pipe_draw_info *info,
for (unsigned i = 0; i < num_draws; i++)
total_count += draws[i].count;
if (!total_count)
return;
/* Allocate space for all index buffers.
*
* This must be done before adding draw_vbo, because it could generate