From c19a3a6ddf463c93716aba2842346eef72f81df7 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Fri, 31 Mar 2023 16:59:32 +0200 Subject: [PATCH] util/vbuf: clarify indirect draws handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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: --- src/gallium/auxiliary/util/u_vbuf.c | 5 +++++ 1 file changed, 5 insertions(+) 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; } -- 2.7.4