From 45b5f467709e3df01aafc37c25070bbbebd43e1e Mon Sep 17 00:00:00 2001 From: Robin Voetter Date: Sat, 8 Apr 2023 19:05:00 +0200 Subject: [PATCH] spirv: allow global, constant address spaces These should actually just work fine in SPIR-V. They are mapped to CrossWorkgroup and UniformConstant respectively. --- src/codegen/spirv.zig | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig index aebe16a10a..63a5942ca9 100644 --- a/src/codegen/spirv.zig +++ b/src/codegen/spirv.zig @@ -1317,11 +1317,22 @@ pub const DeclGen = struct { fn spvStorageClass(as: std.builtin.AddressSpace) StorageClass { return switch (as) { - .generic => .Generic, // TODO: Disallow? - .gs, .fs, .ss => unreachable, + .generic => .Generic, .shared => .Workgroup, .local => .Private, - .global, .param, .constant, .flash, .flash1, .flash2, .flash3, .flash4, .flash5 => unreachable, + .global => .CrossWorkgroup, + .constant => .UniformConstant, + .gs, + .fs, + .ss, + .param, + .flash, + .flash1, + .flash2, + .flash3, + .flash4, + .flash5, + => unreachable, }; }