authorgravatar for robin@voetter.nlRobin Voetter <robin@voetter.nl> 2024-10-20 16:51:15+02:00
committergravatar for robin@voetter.nlRobin Voetter <robin@voetter.nl> 2024-10-27 14:20:52+01:00
log9b42bc1ce5a1d688aa2167a068a3b75d69888c12
tree0eb0a0d99f3d71ada06f4dd24b6a02dd4047ae63
parent6a364b4a5e71b971b753d2b62c7708ae1e76d707
signaturebadge-check Signed by SSH key SHA256:ZS52FNyUv2WUXvO4njmVaFVO46RHojFuOrxRc4LuKzg

spirv: start.zig support for vulkan

* Use builtin.zig_backend instead of builtin.cpu.arch, the latter does not yet compile under VK. * Don't call regular _start for either opencl or vulkan. We might even want to disable these completely.

1 files changed, 2 insertions(+), 3 deletions(-)

lib/std/start.zig+2-3
...@@ -19,8 +19,7 @@ pub const simplified_logic =...@@ -19,8 +19,7 @@ pub const simplified_logic =
19 builtin.zig_backend == .stage2_aarch64 or19 builtin.zig_backend == .stage2_aarch64 or
20 builtin.zig_backend == .stage2_arm or20 builtin.zig_backend == .stage2_arm or
21 builtin.zig_backend == .stage2_sparc64 or21 builtin.zig_backend == .stage2_sparc64 or
22 builtin.cpu.arch == .spirv32 or22 builtin.zig_backend == .stage2_spirv64;
23 builtin.cpu.arch == .spirv64;
2423
25comptime {24comptime {
26 // No matter what, we import the root file, so that any export, test, comptime25 // No matter what, we import the root file, so that any export, test, comptime
...@@ -37,7 +36,7 @@ comptime {...@@ -37,7 +36,7 @@ comptime {
37 if (!@hasDecl(root, "wWinMainCRTStartup") and !@hasDecl(root, "mainCRTStartup")) {36 if (!@hasDecl(root, "wWinMainCRTStartup") and !@hasDecl(root, "mainCRTStartup")) {
38 @export(&wWinMainCRTStartup2, .{ .name = "wWinMainCRTStartup" });37 @export(&wWinMainCRTStartup2, .{ .name = "wWinMainCRTStartup" });
39 }38 }
40 } else if (builtin.os.tag == .opencl) {39 } else if (builtin.os.tag == .opencl or builtin.os.tag == .vulkan) {
41 if (@hasDecl(root, "main"))40 if (@hasDecl(root, "main"))
42 @export(&spirvMain2, .{ .name = "main" });41 @export(&spirvMain2, .{ .name = "main" });
43 } else {42 } else {