aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorRobin Voetter <robin@voetter.nl>2021-05-04 00:32:21 +0200
committerRobin Voetter <robin@voetter.nl>2021-05-14 19:49:32 +0200
commitfa3afede5809cef6c1d5856c1f930344181c16c8 (patch)
treeccb3f05de4eb86e74a07f7937761ebe1b24c356d /lib/std
parent00ebbe6df2249ba8201c0e5472d95022bf73e782 (diff)
downloadzig-fa3afede5809cef6c1d5856c1f930344181c16c8.tar.gz
zig-fa3afede5809cef6c1d5856c1f930344181c16c8.zip
SPIR-V: Set default ofmt to spirv
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/target.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/std/target.zig b/lib/std/target.zig
index d7b00cf79e..d44eb4b064 100644
--- a/lib/std/target.zig
+++ b/lib/std/target.zig
@@ -822,6 +822,13 @@ pub const Target = struct {
};
}
+ pub fn isSPIRV(arch: Arch) bool {
+ return switch (arch) {
+ .spirv32, .spirv64 => true,
+ else => false,
+ };
+ }
+
pub fn parseCpuModel(arch: Arch, cpu_name: []const u8) !*const Cpu.Model {
for (arch.allCpuModels()) |cpu| {
if (mem.eql(u8, cpu_name, cpu.name)) {
@@ -1324,6 +1331,9 @@ pub const Target = struct {
if (cpu_arch.isWasm()) {
return .wasm;
}
+ if (cpu_arch.isSPIRV()) {
+ return .spirv;
+ }
return .elf;
}