aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
diff options
context:
space:
mode:
authorRobin Voetter <robin@voetter.nl>2023-04-08 19:05:00 +0200
committerRobin Voetter <robin@voetter.nl>2023-04-09 01:51:54 +0200
commit45b5f467709e3df01aafc37c25070bbbebd43e1e (patch)
tree59a31b47bab3753a545677482a2e5bca3ece2909 /src/codegen
parentfe0fb93fa04bf4767058cc7046100f3c4f33b3d4 (diff)
downloadzig-45b5f467709e3df01aafc37c25070bbbebd43e1e.tar.gz
zig-45b5f467709e3df01aafc37c25070bbbebd43e1e.zip
spirv: allow global, constant address spaces
These should actually just work fine in SPIR-V. They are mapped to CrossWorkgroup and UniformConstant respectively.
Diffstat (limited to 'src/codegen')
-rw-r--r--src/codegen/spirv.zig17
1 files 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,
};
}