mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 07:08:04 +02:00
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 <sroland@vmware.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3234>
This commit is contained in:
parent
3a4f8c8158
commit
d10a3d528f
1 changed files with 13 additions and 9 deletions
|
|
@ -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->draw_vbo(pipe, &info);
|
||||
|
||||
params += info_in->indirect->stride / 4;
|
||||
}
|
||||
pipe_buffer_unmap(pipe, transfer);
|
||||
|
||||
pipe->draw_vbo(pipe, &info);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue