From: Dave Airlie Date: Mon, 23 Dec 2019 04:56:01 +0000 (+1000) Subject: gallium/util: add multi_draw_indirect to util_draw_indirect. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d10a3d528f1b6492bf8b00b427d52a5009f1955d;p=mesa.git 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: --- 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); }