Add special cases for bit packed structs

This commit adds special cases for AccelerationStructureInstanceKHR and
VkAccelerationStructureSRTMotionInstanceNV. These types use bit-packed
fields which are not representable in the current version of the zig
stage 2 compiler. This might change when
https://github.com/ziglang/zig/issues/13009 is resolved.

Fixes #56
This commit is contained in:
Robin Voetter
2022-10-07 00:15:04 +02:00
parent 80a201f89a
commit 09d2de4fb6
5 changed files with 133 additions and 9 deletions

View File

@@ -75,7 +75,25 @@ pub const GenerateStep = struct {
const spec = try cwd.readFileAlloc(self.builder.allocator, self.spec_path, std.math.maxInt(usize));
var out_buffer = std.ArrayList(u8).init(self.builder.allocator);
try generate(self.builder.allocator, spec, out_buffer.writer());
generate(self.builder.allocator, spec, out_buffer.writer()) catch |err| switch (err) {
error.InvalidXml => {
std.log.err("invalid vulkan registry - invalid xml", .{});
std.log.err("please check that the correct vk.xml file is passed", .{});
return err;
},
error.InvalidRegistry => {
std.log.err("invalid vulkan registry - registry is valid xml but contents are invalid", .{});
std.log.err("please check that the correct vk.xml file is passed", .{});
return err;
},
error.UnhandledBitfieldStruct => {
std.log.err("unhandled struct with bit fields detected in vk.xml", .{});
std.log.err("this is a bug in vulkan-zig", .{});
std.log.err("please make a bug report at https://github.com/Snektron/vulkan-zig/issues/", .{});
return err;
},
error.OutOfMemory => return error.OutOfMemory,
};
try out_buffer.append(0);
const src = out_buffer.items[0 .. out_buffer.items.len - 1 :0];