zink: properly alias shared memory
authorKarol Herbst <kherbst@redhat.com>
Tue, 17 Oct 2023 10:16:24 +0000 (12:16 +0200)
committerKarol Herbst <kherbst@redhat.com>
Fri, 20 Oct 2023 16:49:47 +0000 (18:49 +0200)
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25763>

src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c

index 048619f..b9d0398 100644 (file)
@@ -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