forked from mirror/vulkan-zig
Registry feature and extension types
This commit is contained in:
@@ -2,6 +2,8 @@ pub const Registry = struct {
|
|||||||
decls: []Declaration,
|
decls: []Declaration,
|
||||||
api_constants: []ApiConstant,
|
api_constants: []ApiConstant,
|
||||||
tags: []Tag,
|
tags: []Tag,
|
||||||
|
features: []Feature,
|
||||||
|
extensions: []Extension,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const Declaration = struct {
|
pub const Declaration = struct {
|
||||||
@@ -112,5 +114,37 @@ pub const Array = struct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
pub const Foreign = 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,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ pub fn parseXml(backing_allocator: *Allocator, root: *xml.Element) !ParseResult
|
|||||||
.decls = try parseDeclarations(allocator, root),
|
.decls = try parseDeclarations(allocator, root),
|
||||||
.api_constants = try parseApiConstants(allocator, root),
|
.api_constants = try parseApiConstants(allocator, root),
|
||||||
.tags = try parseTags(allocator, root),
|
.tags = try parseTags(allocator, root),
|
||||||
|
.features = &[_]registry.Feature{},
|
||||||
|
.extensions = &[_]registry.Extension{},
|
||||||
};
|
};
|
||||||
|
|
||||||
return ParseResult{
|
return ParseResult{
|
||||||
@@ -85,14 +87,14 @@ fn parseTypes(allocator: *Allocator, out: []registry.Declaration, types_elem: *x
|
|||||||
|
|
||||||
fn parseForeigntype(ty: *xml.Element) !registry.Declaration {
|
fn parseForeigntype(ty: *xml.Element) !registry.Declaration {
|
||||||
const name = ty.getAttribute("name") orelse return error.InvalidRegistry;
|
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)
|
"vk_platform" // for some reason, int doesn't depend on vk_platform (but the other c types do)
|
||||||
else
|
else
|
||||||
return error.InvalidRegistry;
|
return error.InvalidRegistry;
|
||||||
|
|
||||||
return registry.Declaration{
|
return registry.Declaration{
|
||||||
.name = name,
|
.name = name,
|
||||||
.decl_type = .{.foreign = .{.dependency = dependency}},
|
.decl_type = .{.foreign = .{.depends = depends}},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user