From 37b8130bf9ecfc8c9138211ca9d89554bf70d47d Mon Sep 17 00:00:00 2001 From: Krzysztof Raszkowski Date: Wed, 1 Apr 2020 16:57:20 +0200 Subject: [PATCH] gallium/swr: Fix array stride problem. Reviewed-by: Bruce Cherniak Tested-by: Marge Bot Part-of: --- src/gallium/drivers/swr/swr_state.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp index 625f0050ad5..07ff9b46ad2 100644 --- a/src/gallium/drivers/swr/swr_state.cpp +++ b/src/gallium/drivers/swr/swr_state.cpp @@ -1106,16 +1106,17 @@ swr_user_vbuf_range(const struct pipe_draw_info *info, { /* FIXME: The size is too large - we don't access the full extra stride. */ unsigned elems; + unsigned elem_pitch = vb->stride + velems->stream_pitch[i]; if (velems->instanced_bufs & (1U << i)) { elems = info->instance_count / velems->min_instance_div[i] + 1; *totelems = info->start_instance + elems; *base = info->start_instance * vb->stride; - *size = elems * vb->stride; + *size = elems * elem_pitch; } else if (vb->stride) { elems = info->max_index - info->min_index + 1; *totelems = (info->max_index + info->index_bias) + 1; *base = (info->min_index + info->index_bias) * vb->stride; - *size = elems * vb->stride; + *size = elems * elem_pitch; } else { *totelems = 1; *base = 0; -- 2.30.2