Module: Mesa Branch: staging/22.1 Commit: 235dd6c04f0a8bdfee4aacdbb6e240ac1f56ad9f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=235dd6c04f0a8bdfee4aacdbb6e240ac1f56ad9f
Author: Icecream95 <[email protected]> Date: Sun Jul 10 20:48:16 2022 +1200 panfrost: Only emit images when they are present nr_images is the trigger for allocating double the number of buffers for attributes. When there are no images, there is not always enough space for ALIGN_POT(k, 2) to not move k out of bounds, so don't execute the line in that case. Fixes: dc85f65e059 ("panfrost: emit shader image attribute descriptors") Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17447> (cherry picked from commit fe613a8de95a95a3c44bd47c80316830ab10945e) --- .pick_status.json | 2 +- src/gallium/drivers/panfrost/pan_cmdstream.c | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index f3dc093edc8..aaa507f7a63 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1948,7 +1948,7 @@ "description": "panfrost: Only emit images when they are present", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "dc85f65e059d3c603210bc3a0d93c34bdcdd6d17" }, diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index 37f2144d8b3..404970021c4 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -2068,10 +2068,12 @@ panfrost_emit_vertex_data(struct panfrost_batch *batch, } #endif - k = ALIGN_POT(k, 2); - emit_image_attribs(ctx, PIPE_SHADER_VERTEX, out + so->num_elements, k); - emit_image_bufs(batch, PIPE_SHADER_VERTEX, bufs + k, k); - k += (util_last_bit(ctx->image_mask[PIPE_SHADER_VERTEX]) * 2); + if (nr_images) { + k = ALIGN_POT(k, 2); + emit_image_attribs(ctx, PIPE_SHADER_VERTEX, out + so->num_elements, k); + emit_image_bufs(batch, PIPE_SHADER_VERTEX, bufs + k, k); + k += (util_last_bit(ctx->image_mask[PIPE_SHADER_VERTEX]) * 2); + } #if PAN_ARCH >= 6 /* We need an empty attrib buf to stop the prefetching on Bifrost */
