forked from mirror/vulkan-zig
Make registry generation a member function
This commit is contained in:
@@ -38,6 +38,20 @@ pub const Registry = struct {
|
||||
return registry;
|
||||
}
|
||||
|
||||
pub fn fromXml(allocator: *Allocator, root: *xml.Element) *Registry {
|
||||
std.debug.assert(mem.eql(u8, root.tag, "registry"));
|
||||
|
||||
var registry = Registry.init(allocator) catch unreachable;
|
||||
|
||||
processTypes(registry, root);
|
||||
processEnums(registry, root);
|
||||
processCommands(registry, root);
|
||||
processFeatures(registry, root);
|
||||
processExtensions(registry, root);
|
||||
|
||||
return registry;
|
||||
}
|
||||
|
||||
fn deinit(self: Registry) void {
|
||||
self.declarations_by_name.deinit();
|
||||
|
||||
@@ -517,20 +531,6 @@ const EnumInfo = struct {
|
||||
}
|
||||
};
|
||||
|
||||
pub fn generate(backing_allocator: *Allocator, root: *xml.Element) *Registry {
|
||||
std.debug.assert(mem.eql(u8, root.tag, "registry"));
|
||||
|
||||
var registry = Registry.init(backing_allocator) catch unreachable;
|
||||
|
||||
processTypes(registry, root);
|
||||
processEnums(registry, root);
|
||||
processCommands(registry, root);
|
||||
processFeatures(registry, root);
|
||||
processExtensions(registry, root);
|
||||
|
||||
return registry;
|
||||
}
|
||||
|
||||
fn processTypes(registry: *Registry, root: *xml.Element) void {
|
||||
var types = root.findChildByTag("types").?;
|
||||
var it = types.findChildrenByTag("type");
|
||||
|
||||
Reference in New Issue
Block a user