mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 20:28:04 +02:00
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 2f0749f8fd)
This commit is contained in:
parent
4c3dd94cd1
commit
818dffc733
2 changed files with 8 additions and 7 deletions
|
|
@ -4554,7 +4554,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,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -1535,9 +1535,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) {
|
||||
|
|
@ -1548,7 +1549,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;
|
||||
}
|
||||
|
|
@ -1562,8 +1563,8 @@ zink_set_shader_buffers(struct pipe_context *pctx,
|
|||
zink_screen(ctx->base.screen)->buffer_barrier(ctx, new_res, access,
|
||||
new_res->gfx_barrier);
|
||||
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_read = new_res->obj->unordered_write = false;
|
||||
else
|
||||
|
|
@ -1575,7 +1576,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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue