aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/swr
diff options
context:
space:
mode:
authorKrzysztof Raszkowski <[email protected]>2020-04-01 16:57:20 +0200
committerMarge Bot <[email protected]>2020-04-01 19:43:50 +0000
commit37b8130bf9ecfc8c9138211ca9d89554bf70d47d (patch)
tree2848440d355e77358e27fa360cce030f7d5205db /src/gallium/drivers/swr
parentc1e7e83d52d912b9a1ba5009e8f84d737c1e0d21 (diff)
gallium/swr: Fix array stride problem.
Reviewed-by: Bruce Cherniak <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4405> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4405>
Diffstat (limited to 'src/gallium/drivers/swr')
-rw-r--r--src/gallium/drivers/swr/swr_state.cpp5
1 files 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;