authorgravatar for robin@voetter.nlRobin Voetter <robin@voetter.nl> 2023-04-08 19:05:00+02:00
committergravatar for robin@voetter.nlRobin Voetter <robin@voetter.nl> 2023-04-09 01:51:54+02:00
log45b5f467709e3df01aafc37c25070bbbebd43e1e
tree59a31b47bab3753a545677482a2e5bca3ece2909
parentfe0fb93fa04bf4767058cc7046100f3c4f33b3d4
signaturelock-open Commit is signed but in an unrecognized format.

spirv: allow global, constant address spaces

These should actually just work fine in SPIR-V. They are mapped to CrossWorkgroup and UniformConstant respectively.

1 files changed, 14 insertions(+), 3 deletions(-)

src/codegen/spirv.zig+14-3
...@@ -1317,11 +1317,22 @@ pub const DeclGen = struct {...@@ -1317,11 +1317,22 @@ pub const DeclGen = struct {
13171317
1318 fn spvStorageClass(as: std.builtin.AddressSpace) StorageClass {1318 fn spvStorageClass(as: std.builtin.AddressSpace) StorageClass {
1319 return switch (as) {1319 return switch (as) {
1320 .generic => .Generic, // TODO: Disallow?1320 .generic => .Generic,
1321 .gs, .fs, .ss => unreachable,
1322 .shared => .Workgroup,1321 .shared => .Workgroup,
1323 .local => .Private,1322 .local => .Private,
1324 .global, .param, .constant, .flash, .flash1, .flash2, .flash3, .flash4, .flash5 => unreachable,1323 .global => .CrossWorkgroup,
1324 .constant => .UniformConstant,
1325 .gs,
1326 .fs,
1327 .ss,
1328 .param,
1329 .flash,
1330 .flash1,
1331 .flash2,
1332 .flash3,
1333 .flash4,
1334 .flash5,
1335 => unreachable,
1325 };1336 };
1326 }1337 }
13271338