diff --git a/generator/registry.zig b/generator/registry.zig index 1e0eb90..7bcc751 100644 --- a/generator/registry.zig +++ b/generator/registry.zig @@ -2,6 +2,8 @@ pub const Registry = struct { decls: []Declaration, api_constants: []ApiConstant, tags: []Tag, + features: []Feature, + extensions: []Extension, }; pub const Declaration = struct { @@ -112,5 +114,37 @@ pub const Array = struct { }; pub const Foreign = struct { - dependency: []const u8, // Either a header or vk_platform + depends: []const u8, // Either a header or vk_platform +}; + +pub const Feature = struct { + name: []const u8, + number: []const u8, + requires: []Require, +}; + +pub const Extension = struct { + pub const ExtensionType = enum { + instance, + device, + }; + + name: []const u8, + number: u32, + version: u32, + extension_type: ExtensionType, + depends: []const u8, // Other extensions + requires: []Require, +}; + +pub const Require = struct { + pub const EnumExtension = struct { + extends: []const u8, + field: Enum.Field, + }; + + extends: []EnumExtension, + types: []const []const u8, + commands: []const []const u8, + feature: ?[]const u8, }; diff --git a/generator/registry/parse.zig b/generator/registry/parse.zig index deb9c13..f2cc18a 100644 --- a/generator/registry/parse.zig +++ b/generator/registry/parse.zig @@ -27,6 +27,8 @@ pub fn parseXml(backing_allocator: *Allocator, root: *xml.Element) !ParseResult .decls = try parseDeclarations(allocator, root), .api_constants = try parseApiConstants(allocator, root), .tags = try parseTags(allocator, root), + .features = &[_]registry.Feature{}, + .extensions = &[_]registry.Extension{}, }; return ParseResult{ @@ -85,14 +87,14 @@ fn parseTypes(allocator: *Allocator, out: []registry.Declaration, types_elem: *x fn parseForeigntype(ty: *xml.Element) !registry.Declaration { const name = ty.getAttribute("name") orelse return error.InvalidRegistry; - const dependency = ty.getAttribute("requires") orelse if (mem.eql(u8, name, "int")) + const depends = ty.getAttribute("requires") orelse if (mem.eql(u8, name, "int")) "vk_platform" // for some reason, int doesn't depend on vk_platform (but the other c types do) else return error.InvalidRegistry; return registry.Declaration{ .name = name, - .decl_type = .{.foreign = .{.dependency = dependency}}, + .decl_type = .{.foreign = .{.depends = depends}}, }; }