From d10a3d528f1b6492bf8b00b427d52a5009f1955d Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 23 Dec 2019 14:56:01 +1000 Subject: [PATCH] gallium/util: add multi_draw_indirect to util_draw_indirect. ARB_indirect_parameters needs drivers to deal with mutli_draw_indirect themselves. Reviewed-by: Roland Scheidegger Part-of: --- src/gallium/auxiliary/util/u_draw.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/gallium/auxiliary/util/u_draw.c b/src/gallium/auxiliary/util/u_draw.c index b7daa21c692..4627d2bdbc4 100644 --- a/src/gallium/auxiliary/util/u_draw.c +++ b/src/gallium/auxiliary/util/u_draw.c @@ -147,7 +147,7 @@ util_draw_indirect(struct pipe_context *pipe, pipe_buffer_map_range(pipe, info_in->indirect->buffer, info_in->indirect->offset, - num_params * sizeof(uint32_t), + (num_params * info_in->indirect->draw_count) * sizeof(uint32_t), PIPE_TRANSFER_READ, &transfer); if (!transfer) { @@ -155,14 +155,18 @@ util_draw_indirect(struct pipe_context *pipe, return; } - info.count = params[0]; - info.instance_count = params[1]; - info.start = params[2]; - info.index_bias = info_in->index_size ? params[3] : 0; - info.start_instance = info_in->index_size ? params[4] : params[3]; - info.indirect = NULL; + for (unsigned i = 0; i < info_in->indirect->draw_count; i++) { + info.count = params[0]; + info.instance_count = params[1]; + info.start = params[2]; + info.index_bias = info_in->index_size ? params[3] : 0; + info.start_instance = info_in->index_size ? params[4] : params[3]; + info.drawid = i; + info.indirect = NULL; - pipe_buffer_unmap(pipe, transfer); + pipe->draw_vbo(pipe, &info); - pipe->draw_vbo(pipe, &info); + params += info_in->indirect->stride / 4; + } + pipe_buffer_unmap(pipe, transfer); } -- 2.30.2