Module: Mesa
Branch: main
Commit: c3516861e86c486e015443f2d61adffc8a9e1b32
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c3516861e86c486e015443f2d61adffc8a9e1b32

Author: Karol Herbst <[email protected]>
Date:   Tue Oct 17 12:16:24 2023 +0200

zink: properly alias shared memory

Signed-off-by: Karol Herbst <[email protected]>
Acked-by: Mike Blumenkrantz <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25763>

---

 src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c 
b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
index 048619ff437..b9d0398d1b7 100644
--- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
+++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
@@ -699,6 +699,12 @@ create_shared_block(struct ntv_context *ctx, unsigned 
bit_size)
       assert(ctx->num_entry_ifaces < ARRAY_SIZE(ctx->entry_ifaces));
       ctx->entry_ifaces[ctx->num_entry_ifaces++] = ctx->shared_block_var[idx];
    }
+   /* Alias our shared memory blocks */
+   if (ctx->sinfo->have_workgroup_memory_explicit_layout) {
+      spirv_builder_emit_member_offset(&ctx->builder, block, 0, 0);
+      spirv_builder_emit_decoration(&ctx->builder, block, SpvDecorationBlock);
+      spirv_builder_emit_decoration(&ctx->builder, ctx->shared_block_var[idx], 
SpvDecorationAliased);
+   }
 }
 
 static SpvId

Reply via email to