diff options
| author | Robin Voetter <robin@voetter.nl> | 2023-11-23 23:58:50 +0100 |
|---|---|---|
| committer | Robin Voetter <robin@voetter.nl> | 2023-11-24 11:40:18 +0100 |
| commit | b4b1c4df640c9b40c303eef7d0364d01ec490a8e (patch) | |
| tree | bf5d534fb5b3c7cdb3b78f2846e4272939258e45 /src/codegen | |
| parent | cb026c5d599dddc38f34ee93438d52bbffe2f6ad (diff) | |
| download | zig-b4b1c4df640c9b40c303eef7d0364d01ec490a8e.tar.gz zig-b4b1c4df640c9b40c303eef7d0364d01ec490a8e.zip | |
spirv: add -fstructured-cfg option
This enables the compiler to generate a structured cfg even in opencl,
even if it is not strictly required by the SPIR-V Kernel specification.
Diffstat (limited to 'src/codegen')
| -rw-r--r-- | src/codegen/spirv.zig | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig index 8bee639b60..7901e37135 100644 --- a/src/codegen/spirv.zig +++ b/src/codegen/spirv.zig @@ -99,6 +99,15 @@ pub const Object = struct { air: Air, liveness: Liveness, ) !void { + const target = mod.getTarget(); + // We always want a structured control flow in shaders. This option is only relevant + // for OpenCL kernels. + const want_structured_cfg = switch (target.os.tag) { + .opencl => mod.comp.bin_file.options.want_structured_cfg orelse false, + else => true, + }; + _ = want_structured_cfg; + var decl_gen = DeclGen{ .gpa = self.gpa, .object = self, |
