summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2023-05-08 16:31:18 -0400
committerEric Engestrom <eric@engestrom.ch>2023-05-09 16:56:42 +0100
commit68e639c56ca03267aa367b69296c8e7ba60abb94 (patch)
tree5a0649e17d28ade1a96565952c1c427ab1374985
parentbc403d5f4fc545411ba49ff1bcccfc51feb173b7 (diff)
downloadmesa-68e639c56ca03267aa367b69296c8e7ba60abb94.tar.gz
zink: use an intermediate variable for binding ssbo slots
this makes the bug more obvious cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22907> (cherry picked from commit 2f0749f8fda55ad851cf1aba19019adf18225e0f)
-rw-r--r--.pick_status.json2
-rw-r--r--src/gallium/drivers/zink/zink_context.c13
2 files changed, 8 insertions, 7 deletions
diff --git a/.pick_status.json b/.pick_status.json
index b9fa823f2fb..d0b6fc3f1c1 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -238,7 +238,7 @@
"description": "zink: use an intermediate variable for binding ssbo slots",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": null
},
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index d0032dbf2ad..e8393bc8629 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -1586,9 +1586,10 @@ zink_set_shader_buffers(struct pipe_context *pctx,
ctx->writable_ssbos[p_stage] |= writable_bitmask << start_slot;
for (unsigned i = 0; i < count; i++) {
- struct pipe_shader_buffer *ssbo = &ctx->ssbos[p_stage][start_slot + i];
+ unsigned slot = start_slot + i;
+ struct pipe_shader_buffer *ssbo = &ctx->ssbos[p_stage][slot];
struct zink_resource *res = ssbo->buffer ? zink_resource(ssbo->buffer) : NULL;
- bool was_writable = old_writable_mask & BITFIELD64_BIT(start_slot + i);
+ bool was_writable = old_writable_mask & BITFIELD64_BIT(slot);
if (buffers && buffers[i].buffer) {
struct zink_resource *new_res = zink_resource(buffers[i].buffer);
if (new_res != res) {
@@ -1599,7 +1600,7 @@ zink_set_shader_buffers(struct pipe_context *pctx,
update_res_bind_count(ctx, new_res, p_stage == MESA_SHADER_COMPUTE, false);
}
VkAccessFlags access = VK_ACCESS_SHADER_READ_BIT;
- if (ctx->writable_ssbos[p_stage] & BITFIELD64_BIT(start_slot + i)) {
+ if (ctx->writable_ssbos[p_stage] & BITFIELD64_BIT(slot)) {
new_res->write_bind_count[p_stage == MESA_SHADER_COMPUTE]++;
access |= VK_ACCESS_SHADER_WRITE_BIT;
}
@@ -1613,8 +1614,8 @@ zink_set_shader_buffers(struct pipe_context *pctx,
new_res->gfx_barrier);
zink_batch_resource_usage_set(&ctx->batch, new_res, access & VK_ACCESS_SHADER_WRITE_BIT, true);
update = true;
- max_slot = MAX2(max_slot, start_slot + i);
- update_descriptor_state_ssbo(ctx, p_stage, start_slot + i, new_res);
+ max_slot = MAX2(max_slot, slot);
+ update_descriptor_state_ssbo(ctx, p_stage, slot, new_res);
if (zink_resource_access_is_write(access))
new_res->obj->unordered_write = false;
new_res->obj->unordered_read = false;
@@ -1625,7 +1626,7 @@ zink_set_shader_buffers(struct pipe_context *pctx,
ssbo->buffer_size = 0;
if (res) {
unbind_ssbo(ctx, res, p_stage, i, was_writable);
- update_descriptor_state_ssbo(ctx, p_stage, start_slot + i, NULL);
+ update_descriptor_state_ssbo(ctx, p_stage, slot, NULL);
}
pipe_resource_reference(&ssbo->buffer, NULL);
}