generate wrapper for command aliases

Instead of generating a Zig alias for aliased commands, actual wrappers
are now generated. This should make sure that extension commands, such as
vkCmdBeginRenderingKHR, can still be used on older Vulkan implementations.
This commit is contained in:
Robin Voetter
2023-04-17 20:09:30 +02:00
parent 02939ff026
commit 8b452b9edd

View File

@@ -1210,17 +1210,11 @@ fn Renderer(comptime WriterType: type) type {
if (classifyCommandDispatch(decl.name, command) != dispatch_type) {
continue;
}
switch (decl.decl_type) {
.command => try self.renderWrapper(decl.name, decl.decl_type.command),
.alias => |alias| {
try self.writer.writeAll("pub const ");
try self.writeIdentifierWithCase(.camel, trimVkNamespace(decl.name));
try self.writer.writeAll(" = ");
try self.writeIdentifierWithCase(.camel, trimVkNamespace(alias.name));
try self.writer.writeAll(";\n");
},
else => unreachable,
}
// Note: If this decl is an alias, generate a full wrapper instead of simply an
// alias like `const old = new;`. This ensures that Vulkan bindings generated
// for newer versions of vulkan can still invoke extension behavior on older
// implementations.
try self.renderWrapper(decl.name, command);
}
try self.writer.writeAll("};}\n");