From e1c006204ff9fc32e66749b4cba9ea33b2c1af0a Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 20 Apr 2020 15:39:50 +1000 Subject: [PATCH] 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 Part-of: --- src/gallium/auxiliary/util/u_draw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/util/u_draw.c b/src/gallium/auxiliary/util/u_draw.c index a2ce0e39483..a43938774bb 100644 --- a/src/gallium/auxiliary/util/u_draw.c +++ b/src/gallium/auxiliary/util/u_draw.c @@ -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, -- 2.30.2