authorgravatar for robin@voetter.nlRobin Voetter <robin@voetter.nl> 2023-11-21 19:58:29+01:00
committergravatar for robin@voetter.nlRobin Voetter <robin@voetter.nl> 2023-11-24 01:11:15+01:00
logcb026c5d599dddc38f34ee93438d52bbffe2f6ad
tree75bf3c0edeac952b30eaac1dc4a4ef1d579824f4
parent255737ea572f437afb1f2ad67096d3a157d79d70
signaturebadge-check Signed by SSH key SHA256:CQ99aPxq+RueiL9u7z0FEki5Fm7V6T8q4PrEGmINrA4

spirv: always emit mask constants even if no bits are set

A parameter like this is not always optional, even if that is usually implied. SPIR-V tools fail to parse a module with an OpLoopMerge instruction where the loop control parameter is left out.

1 files changed, 0 insertions(+), 7 deletions(-)

src/codegen/spirv/Section.zig-7
...@@ -198,10 +198,6 @@ fn writeExtendedMask(section: *Section, comptime Operand: type, operand: Operand...@@ -198,10 +198,6 @@ fn writeExtendedMask(section: *Section, comptime Operand: type, operand: Operand
198 }198 }
199 }199 }
200200
201 if (mask == 0) {
202 return;
203 }
204
205 section.writeWord(mask);201 section.writeWord(mask);
206202
207 inline for (@typeInfo(Operand).Struct.fields) |field| {203 inline for (@typeInfo(Operand).Struct.fields) |field| {
...@@ -304,9 +300,6 @@ fn extendedMaskSize(comptime Operand: type, operand: Operand) usize {...@@ -304,9 +300,6 @@ fn extendedMaskSize(comptime Operand: type, operand: Operand) usize {
304 else => unreachable,300 else => unreachable,
305 }301 }
306 }302 }
307 if (!any_set) {
308 return 0;
309 }
310 return total + 1; // Add one for the mask itself.303 return total + 1; // Add one for the mask itself.
311}304}
312305