aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/spirv/Module.zig
diff options
context:
space:
mode:
authorAli Cheraghi <alichraghi@proton.me>2025-02-19 00:06:10 +0330
committerRobin Voetter <robin@voetter.nl>2025-02-24 19:12:33 +0100
commita0eec9ce9e2f4ae40729949957bef98a2513fef7 (patch)
treef17a4ac38256a6b0601a68439f562dc477c57989 /src/codegen/spirv/Module.zig
parent1cc388d5263058f9e9eecc410eea825a9a58e143 (diff)
downloadzig-a0eec9ce9e2f4ae40729949957bef98a2513fef7.tar.gz
zig-a0eec9ce9e2f4ae40729949957bef98a2513fef7.zip
spirv: replace some unreachables with compile errors
Diffstat (limited to 'src/codegen/spirv/Module.zig')
-rw-r--r--src/codegen/spirv/Module.zig12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/codegen/spirv/Module.zig b/src/codegen/spirv/Module.zig
index 317e32c878..30f9b0bc54 100644
--- a/src/codegen/spirv/Module.zig
+++ b/src/codegen/spirv/Module.zig
@@ -345,22 +345,30 @@ pub fn finalize(self: *Module, a: Allocator) ![]Word {
if (self.target.cpu.features.isEnabled(feature.index)) {
const feature_tag: std.Target.spirv.Feature = @enumFromInt(feature.index);
switch (feature_tag) {
+ // 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),
+ .matrix => try self.addCapability(.Matrix),
+ .storage_push_constant16 => {
+ try self.addExtension("SPV_KHR_16bit_storage");
+ try self.addCapability(.StoragePushConstant16);
+ },
.addresses => if (self.hasFeature(.shader)) {
- try self.addCapability(.PhysicalStorageBufferAddresses);
try self.addExtension("SPV_KHR_physical_storage_buffer");
+ try self.addCapability(.PhysicalStorageBufferAddresses);
} else {
try self.addCapability(.Addresses);
},
- .matrix => try self.addCapability(.Matrix),
+ // Kernel
.kernel => try self.addCapability(.Kernel),
.generic_pointer => try self.addCapability(.GenericPointer),
.vector16 => try self.addCapability(.Vector16),
+ // Shader
.shader => try self.addCapability(.Shader),
}
}