diff options
| author | Robin Voetter <robin@voetter.nl> | 2024-03-02 13:08:21 +0100 |
|---|---|---|
| committer | Robin Voetter <robin@voetter.nl> | 2024-03-18 19:13:50 +0100 |
| commit | 9b18125562b2402cae8450253decd906f09e4dc6 (patch) | |
| tree | 5525843896ccb333dfeb4fe832c565f4e1cd3b49 /src/codegen/spirv/Cache.zig | |
| parent | 20d7bb68ac7043e7d4ec8f0653ec73a1090187da (diff) | |
| download | zig-9b18125562b2402cae8450253decd906f09e4dc6.tar.gz zig-9b18125562b2402cae8450253decd906f09e4dc6.zip | |
spirv: make generic globals invocation-local
Diffstat (limited to 'src/codegen/spirv/Cache.zig')
| -rw-r--r-- | src/codegen/spirv/Cache.zig | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/src/codegen/spirv/Cache.zig b/src/codegen/spirv/Cache.zig index 93921204db..e8460e1d79 100644 --- a/src/codegen/spirv/Cache.zig +++ b/src/codegen/spirv/Cache.zig @@ -134,7 +134,10 @@ const Tag = enum { /// data is (bool) type bool_false, - const SimpleType = enum { void, bool }; + const SimpleType = enum { + void, + bool, + }; const VectorType = Key.VectorType; const ArrayType = Key.ArrayType; @@ -287,11 +290,12 @@ pub const Key = union(enum) { pub const PointerType = struct { storage_class: StorageClass, child_type: Ref, + /// Ref to a .fwd_ptr_type. fwd: Ref, // TODO: Decorations: // - Alignment - // - ArrayStride, - // - MaxByteOffset, + // - ArrayStride + // - MaxByteOffset }; pub const ForwardPointerType = struct { @@ -728,6 +732,9 @@ pub fn resolve(self: *Self, spv: *Module, key: Key) !Ref { // }, .ptr_type => |ptr| Item{ .tag = .type_ptr_simple, + // For this variant we need to steal the ID of the forward-declaration, instead + // of allocating one manually. This will make sure that we get a single result-id + // any possibly forward declared pointer type. .result_id = self.resultId(ptr.fwd), .data = try self.addExtra(spv, Tag.SimplePointerType{ .storage_class = ptr.storage_class, @@ -896,24 +903,6 @@ pub fn lookup(self: *const Self, ref: Ref) Key { }, }; }, - // .type_ptr_generic => .{ - // .ptr_type = .{ - // .storage_class = .Generic, - // .child_type = @enumFromInt(data), - // }, - // }, - // .type_ptr_crosswgp => .{ - // .ptr_type = .{ - // .storage_class = .CrossWorkgroup, - // .child_type = @enumFromInt(data), - // }, - // }, - // .type_ptr_function => .{ - // .ptr_type = .{ - // .storage_class = .Function, - // .child_type = @enumFromInt(data), - // }, - // }, .type_ptr_simple => { const payload = self.extraData(Tag.SimplePointerType, data); return .{ |
