| ... | ... | @@ -2148,12 +2148,26 @@ pub const Key = union(enum) { |
| 2148 | 2148 | }; |
| 2149 | 2149 | |
| 2150 | 2150 | pub const SpirvType = extern struct { |
| 2151 | | /// A `spirv_reify` instruction. |
| 2152 | | zir_index: TrackedInst.Index, |
| 2153 | | /// Always 0. |
| 2154 | | padding: u32 = 0, |
| 2155 | | /// A hash of this type's attributes generated by Sema. |
| 2156 | | type_hash: u64, |
| 2151 | /// If tag is `.image`, this is the sampled type or `.none` if `usage` is `.storage`. |
| 2152 | /// If tag is `.sampled_image`, this is the image type. |
| 2153 | /// If tag is `.runtime_array`, this is the element type. |
| 2154 | /// Otherwise this is `.none`. |
| 2155 | ty: Index, |
| 2156 | flags: Flags, |
| 2157 | |
| 2158 | pub const Flags = packed struct(u32) { |
| 2159 | tag: @typeInfo(std.lang.Type.Spirv).@"union".tag_type.?, |
| 2160 | // Image type flags |
| 2161 | usage: @typeInfo(std.lang.Type.Spirv.Image.Usage).@"union".tag_type.?, |
| 2162 | format: std.lang.Type.Spirv.Image.Format, |
| 2163 | dim: std.lang.Type.Spirv.Image.Dimensionality, |
| 2164 | depth: std.lang.Type.Spirv.Image.Depth, |
| 2165 | access: std.lang.Type.Spirv.Image.Access, |
| 2166 | is_arrayed: bool, |
| 2167 | is_multisampled: bool, |
| 2168 | |
| 2169 | _: u16 = 0, |
| 2170 | }; |
| 2157 | 2171 | }; |
| 2158 | 2172 | |
| 2159 | 2173 | pub const FuncType = struct { |
| ... | ... | @@ -5054,6 +5068,7 @@ pub const Tag = enum(u8) { |
| 5054 | 5068 | const EnumTag = Key.EnumTag; |
| 5055 | 5069 | const Union = Key.Union; |
| 5056 | 5070 | const TypePointer = Key.PtrType; |
| 5071 | const TypeSpirv = Key.SpirvType; |
| 5057 | 5072 | |
| 5058 | 5073 | const struct_packed_encoding = .{ |
| 5059 | 5074 | .summary = .@"{.payload.name%summary#\"}", |
| ... | ... | @@ -5266,7 +5281,7 @@ pub const Tag = enum(u8) { |
| 5266 | 5281 | }, |
| 5267 | 5282 | .type_enum_explicit = enum_explicit_encoding, |
| 5268 | 5283 | .type_enum_nonexhaustive = enum_explicit_encoding, |
| 5269 | | .type_spirv = .{ .summary = .@"{.payload.name%summary#\"}", .payload = Tag.TypeSpirv }, |
| 5284 | .type_spirv = .{ .payload = Tag.TypeSpirv }, |
| 5270 | 5285 | .type_opaque = .{ |
| 5271 | 5286 | .summary = .@"{.payload.name%summary#\"}", |
| 5272 | 5287 | .payload = TypeOpaque, |
| ... | ... | @@ -5723,34 +5738,6 @@ pub const Tag = enum(u8) { |
| 5723 | 5738 | name_nav: Nav.Index.Optional, |
| 5724 | 5739 | namespace: NamespaceIndex, |
| 5725 | 5740 | }; |
| 5726 | | |
| 5727 | | /// Trailing: |
| 5728 | | /// 0. type_hash: PackedU64 |
| 5729 | | pub const TypeSpirv = struct { |
| 5730 | | name: NullTerminatedString, |
| 5731 | | /// The index of the `reify_spirv_type` instruction. |
| 5732 | | zir_index: TrackedInst.Index, |
| 5733 | | /// If tag is `.image`, this is the sampled type or `.none` if `usage` is `.storage`. |
| 5734 | | /// If tag is `.sampled_image`, this is the image type. |
| 5735 | | /// If tag is `.runtime_array`, this is the element type. |
| 5736 | | /// Otherwise this is `.none`. |
| 5737 | | ty: Index, |
| 5738 | | flags: Flags, |
| 5739 | | |
| 5740 | | pub const Flags = packed struct(u32) { |
| 5741 | | tag: @typeInfo(std.lang.Type.Spirv).@"union".tag_type.?, |
| 5742 | | // Image type flags |
| 5743 | | usage: @typeInfo(std.lang.Type.Spirv.Image.Usage).@"union".tag_type.?, |
| 5744 | | format: std.lang.Type.Spirv.Image.Format, |
| 5745 | | dim: std.lang.Type.Spirv.Image.Dimensionality, |
| 5746 | | depth: std.lang.Type.Spirv.Image.Depth, |
| 5747 | | access: std.lang.Type.Spirv.Image.Access, |
| 5748 | | is_arrayed: bool, |
| 5749 | | is_multisampled: bool, |
| 5750 | | |
| 5751 | | _: u16 = 0, |
| 5752 | | }; |
| 5753 | | }; |
| 5754 | 5741 | }; |
| 5755 | 5742 | |
| 5756 | 5743 | /// Differentiates between user-provided and compiler-generated backing types for packed and tagged types. |
| ... | ... | @@ -6634,11 +6621,10 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 6634 | 6621 | }; |
| 6635 | 6622 | } }, |
| 6636 | 6623 | .type_spirv => .{ .spirv_type = ns: { |
| 6637 | | const extra_list = unwrapped_index.getExtra(ip); |
| 6638 | | const extra = extraDataTrail(extra_list, Tag.TypeSpirv, data); |
| 6624 | const extra = extraData(unwrapped_index.getExtra(ip), Tag.TypeSpirv, data); |
| 6639 | 6625 | break :ns .{ |
| 6640 | | .zir_index = extra.data.zir_index, |
| 6641 | | .type_hash = extraData(extra_list, PackedU64, extra.end).get(), |
| 6626 | .ty = extra.ty, |
| 6627 | .flags = extra.flags, |
| 6642 | 6628 | }; |
| 6643 | 6629 | } }, |
| 6644 | 6630 | .type_opaque => .{ .opaque_type = ns: { |
| ... | ... | @@ -8794,15 +8780,11 @@ pub fn getReifiedSpirvType( |
| 8794 | 8780 | gpa: Allocator, |
| 8795 | 8781 | io: Io, |
| 8796 | 8782 | tid: Zcu.PerThread.Id, |
| 8797 | | ini: struct { |
| 8798 | | zir_index: TrackedInst.Index, |
| 8799 | | type_hash: u64, |
| 8800 | | type_spirv: Tag.TypeSpirv, |
| 8801 | | }, |
| 8783 | type_spirv: Key.SpirvType, |
| 8802 | 8784 | ) Allocator.Error!Index { |
| 8803 | 8785 | var gop = try ip.getOrPutKey(gpa, io, tid, .{ .spirv_type = .{ |
| 8804 | | .zir_index = ini.zir_index, |
| 8805 | | .type_hash = ini.type_hash, |
| 8786 | .ty = type_spirv.ty, |
| 8787 | .flags = type_spirv.flags, |
| 8806 | 8788 | } }); |
| 8807 | 8789 | defer gop.deinit(); |
| 8808 | 8790 | if (gop == .existing) return gop.existing; |
| ... | ... | @@ -8812,11 +8794,8 @@ pub fn getReifiedSpirvType( |
| 8812 | 8794 | const extra = local.getMutableExtra(gpa, io); |
| 8813 | 8795 | try items.ensureUnusedCapacity(1); |
| 8814 | 8796 | |
| 8815 | | try extra.ensureUnusedCapacity(@typeInfo(Tag.TypeSpirv).@"struct".field_names.len + |
| 8816 | | 2 // type_hash: PackedU64 |
| 8817 | | ); |
| 8818 | | const extra_index = addExtraAssumeCapacity(extra, ini.type_spirv); |
| 8819 | | _ = addExtraAssumeCapacity(extra, PackedU64.init(ini.type_hash)); |
| 8797 | try extra.ensureUnusedCapacity(@typeInfo(Tag.TypeSpirv).@"struct".field_names.len); |
| 8798 | const extra_index = addExtraAssumeCapacity(extra, type_spirv); |
| 8820 | 8799 | |
| 8821 | 8800 | items.appendAssumeCapacity(.{ .tag = .type_spirv, .data = extra_index }); |
| 8822 | 8801 | return gop.put(); |
| ... | ... | @@ -10711,7 +10690,7 @@ fn dumpStatsFallible(ip: *const InternPool, w: *Io.Writer, arena: Allocator) !vo |
| 10711 | 10690 | .type_optional => 0, |
| 10712 | 10691 | .type_anyframe => 0, |
| 10713 | 10692 | .type_error_union => @sizeOf(Key.ErrorUnionType), |
| 10714 | | .type_spirv => @sizeOf(Tag.TypeSpirv) + @sizeOf(PackedU64), |
| 10693 | .type_spirv => @sizeOf(Tag.TypeSpirv), |
| 10715 | 10694 | .type_anyerror_union => 0, |
| 10716 | 10695 | .type_error_set => b: { |
| 10717 | 10696 | const info = extraData(extra_list, Tag.ErrorSet, data); |