util/indirect: handle stride less than number of parameters.

It's legal to have a stride less than the num of parameters,
in this case no need to try and over map the buffer which asserts

Fixes:
GTF-GL45.gtf43.GL3Tests.multi_draw_indirect.multi_draw_indirect_stride

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4574>
This commit is contained in:
Dave Airlie 2020-04-20 15:39:50 +10:00
parent 23efd323aa
commit e1c006204f
1 changed files with 3 additions and 1 deletions

View File

@ -136,7 +136,7 @@ util_draw_indirect(struct pipe_context *pipe,
struct pipe_draw_info info;
struct pipe_transfer *transfer;
uint32_t *params;
const unsigned num_params = info_in->index_size ? 5 : 4;
unsigned num_params = info_in->index_size ? 5 : 4;
assert(info_in->indirect);
assert(!info_in->count_from_stream_output);
@ -160,6 +160,8 @@ util_draw_indirect(struct pipe_context *pipe,
pipe_buffer_unmap(pipe, dc_transfer);
}
if (info_in->indirect->stride)
num_params = MIN2(info_in->indirect->stride / 4, num_params);
params = (uint32_t *)
pipe_buffer_map_range(pipe,
info_in->indirect->buffer,