diff options
| author | Ali Cheraghi <alichraghi@proton.me> | 2025-03-13 03:01:19 +0330 |
|---|---|---|
| committer | Ali Cheraghi <alichraghi@proton.me> | 2025-03-18 07:05:50 +0330 |
| commit | ee06b2ce760d927b62726de1e2e3cb33b48d4932 (patch) | |
| tree | 6046947d801d8c10b3dd1fd98d3ae8aba5da187a /src/codegen | |
| parent | d18eaf8586cf173d5605d5885fcbe26d64af00c5 (diff) | |
| download | zig-ee06b2ce760d927b62726de1e2e3cb33b48d4932.tar.gz zig-ee06b2ce760d927b62726de1e2e3cb33b48d4932.zip | |
spirv: require int8/int16 capabilities
Diffstat (limited to 'src/codegen')
| -rw-r--r-- | src/codegen/spirv.zig | 8 | ||||
| -rw-r--r-- | src/codegen/spirv/Module.zig | 5 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig index 899a8db7fe..c361090b51 100644 --- a/src/codegen/spirv.zig +++ b/src/codegen/spirv.zig @@ -588,11 +588,11 @@ const NavGen = struct { if (self.spv.hasFeature(.arbitrary_precision_integers) and bits <= 32) return bits; - // 8, 16 and 64-bit integers require the Int8, Int16 and Inr64 capabilities respectively. + // We require Int8 and Int16 capabilities and benefit Int64 when available. // 32-bit integers are always supported (see spec, 2.16.1, Data rules). const ints = [_]struct { bits: u16, feature: ?Target.spirv.Feature }{ - .{ .bits = 8, .feature = .int8 }, - .{ .bits = 16, .feature = .int16 }, + .{ .bits = 8, .feature = null }, + .{ .bits = 16, .feature = null }, .{ .bits = 32, .feature = null }, .{ .bits = 64, .feature = .int64 }, }; @@ -1373,7 +1373,7 @@ const NavGen = struct { var member_types: [4]IdRef = undefined; var member_names: [4][]const u8 = undefined; - const u8_ty_id = try self.resolveType(Type.u8, .direct); // TODO: What if Int8Type is not enabled? + const u8_ty_id = try self.resolveType(Type.u8, .direct); if (layout.tag_size != 0) { const tag_ty_id = try self.resolveType(Type.fromInterned(union_obj.enum_tag_ty), .indirect); diff --git a/src/codegen/spirv/Module.zig b/src/codegen/spirv/Module.zig index 1acdc0915c..1aa082f6bc 100644 --- a/src/codegen/spirv/Module.zig +++ b/src/codegen/spirv/Module.zig @@ -333,8 +333,6 @@ pub fn finalize(self: *Module, a: Allocator) ![]Word { // Versions .v1_0, .v1_1, .v1_2, .v1_3, .v1_4, .v1_5, .v1_6 => {}, // Features with no dependencies - .int8 => try self.addCapability(.Int8), - .int16 => try self.addCapability(.Int16), .int64 => try self.addCapability(.Int64), .float16 => try self.addCapability(.Float16), .float64 => try self.addCapability(.Float64), @@ -361,6 +359,9 @@ pub fn finalize(self: *Module, a: Allocator) ![]Word { } } } + // These are well supported + try self.addCapability(.Int8); + try self.addCapability(.Int16); // Emit memory model const addressing_model: spec.AddressingModel = blk: { |
