diff options
| author | Robin Voetter <robin@voetter.nl> | 2023-10-08 11:04:48 +0200 |
|---|---|---|
| committer | Robin Voetter <robin@voetter.nl> | 2023-10-15 14:00:06 +0200 |
| commit | d0e7a3596ba480fdbc59644fd13859efe3024ea8 (patch) | |
| tree | 21712527555edc3a102ae9013b81e2f12ed1e5c0 /src/codegen/spirv.zig | |
| parent | 2d52fc762da7e7288c4caa381fb02933c205e9be (diff) | |
| download | zig-d0e7a3596ba480fdbc59644fd13859efe3024ea8.tar.gz zig-d0e7a3596ba480fdbc59644fd13859efe3024ea8.zip | |
spirv: allow generation of *i0
Diffstat (limited to 'src/codegen/spirv.zig')
| -rw-r--r-- | src/codegen/spirv.zig | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig index e8e1b89507..dc572d390e 100644 --- a/src/codegen/spirv.zig +++ b/src/codegen/spirv.zig @@ -1219,7 +1219,14 @@ const DeclGen = struct { }, .Int => { const int_info = ty.intInfo(mod); - // TODO: Integers in OpenCL kernels are always unsigned. + if (int_info.bits == 0) { + // Some times, the backend will be asked to generate a pointer to i0. OpTypeInt + // with 0 bits is invalid, so return an opaque type in this case. + assert(repr == .indirect); + return try self.spv.resolve(.{ .opaque_type = .{ + .name = try self.spv.resolveString("u0"), + } }); + } return try self.intType(int_info.signedness, int_info.bits); }, .Enum => { |
