From: Pierre-Eric Pelloux-Prayer Date: Fri, 31 Mar 2023 14:59:32 +0000 (+0200) Subject: util/vbuf: clarify indirect draws handling X-Git-Tag: upstream/23.3.3~10548 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c19a3a6ddf463c93716aba2842346eef72f81df7;p=platform%2Fupstream%2Fmesa.git util/vbuf: clarify indirect draws handling It wasn't obvious from the u_vbuf code alone that num_draws is guaranteed to be 1 in the indirect case. Reviewed-by: Marek Olšák Part-of: --- diff --git a/src/gallium/auxiliary/util/u_vbuf.c b/src/gallium/auxiliary/util/u_vbuf.c index c0ea0e2..c16861f 100644 --- a/src/gallium/auxiliary/util/u_vbuf.c +++ b/src/gallium/auxiliary/util/u_vbuf.c @@ -1512,6 +1512,9 @@ void u_vbuf_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *inf if (indirect && indirect->buffer) { unsigned draw_count = 0; + /* num_draws can only be 1 with indirect draws. */ + assert(num_draws == 1); + /* Get the number of draws. */ if (indirect->indirect_draw_count) { pipe_buffer_read(pipe, indirect->indirect_draw_count, @@ -1547,6 +1550,7 @@ void u_vbuf_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *inf u_vbuf_split_indexed_multidraw(mgr, &new_info, drawid_offset, data, indirect->stride, draw_count); free(data); + /* We're done (as num_draws is 1), so return early. */ return; } @@ -1563,6 +1567,7 @@ void u_vbuf_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *inf u_vbuf_split_indexed_multidraw(mgr, &new_info, drawid_offset, data, indirect->stride, draw_count); free(data); + /* We're done (as num_draws is 1), so return early. */ return; }