Commit 45b5f46770

Robin Voetter <robin@voetter.nl>
2023-04-08 19:05:00
spirv: allow global, constant address spaces
These should actually just work fine in SPIR-V. They are mapped to CrossWorkgroup and UniformConstant respectively.
1 parent fe0fb93
Changed files (1)
src
codegen
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,
         };
     }