diff options
author | Boris Brezillon <boris.brezillon@collabora.com> | 2024-04-26 09:29:10 +0000 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2024-04-26 11:18:17 +0000 |
commit | 186f7fa915b1d748f73a13f12c089af4e47b5c29 (patch) | |
tree | 242eb3c71c0103d0a54753fb72373db5d1cc9dde | |
parent | 39f919707afe5185733206f6f22a09b8f19a4937 (diff) |
panfrost: do not write outside num_wg_sysval
This array has 3 components, because it's meant to hold the X, Y and Z
components of the work-group size sysval. However, mir_pick_ubo assumes
vec4 for the push-uniforms, which ends up promoting this to 4
components.
So let's make sure we don't write that last component. It's not going to
do anything good.
In practice, this leads to the viewport descriptor being smashed, which
doesn't actually do any real-world harm, because this only happens in
compute batches where that descriptor is unused. However, writing
outside of arrays is undefined behavior, so we should fix it regardless.
Fixes: 50061670614 ("panfrost: Hook-up indirect dispatch support")
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28856>
-rw-r--r-- | src/gallium/drivers/panfrost/pan_cmdstream.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index dfc5f4c515a..d10fabb62dd 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -1405,7 +1405,8 @@ panfrost_emit_const_buf(struct panfrost_batch *batch, PAN_SYSVAL_TYPE(ss->sysvals.sysvals[sysval_idx]); mali_ptr ptr = push_transfer.gpu + (4 * i); - if (sysval_type == PAN_SYSVAL_NUM_WORK_GROUPS) + if (sysval_type == PAN_SYSVAL_NUM_WORK_GROUPS && + sysval_comp < ARRAY_SIZE(batch->num_wg_sysval)) batch->num_wg_sysval[sysval_comp] = ptr; } /* Map the UBO, this should be cheap. For some buffers this may |