Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Vulkan-1.3.219 validstructs attribute on <param> #24

Merged
merged 1 commit into from
Jul 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions vk-parse/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ macro_rules! unwrap_attribute (
);

macro_rules! match_attributes {
($ctx:expr, $a:ident in $attributes:expr, $($p:pat => $e:expr),+) => {
($ctx:expr, $a:ident in $attributes:expr, $($p:pat => $e:expr),+ $(,)?) => {
for $a in $attributes {
let n = $a.name.local_name.as_str();
match n {
Expand Down Expand Up @@ -669,17 +669,24 @@ fn parse_command<R: Read>(ctx: &mut ParseCtx<R>, attributes: Vec<XmlAttribute>)
let mut optional = None;
let mut noautovalidity = None;
let mut objecttype = None;
let mut validstructs = None;

match_attributes!{ctx, a in attributes,
"len" => len = Some(a.value),
"altlen" => altlen = Some(a.value),
"externsync" => externsync = Some(a.value),
"optional" => optional = Some(a.value),
"noautovalidity" => noautovalidity = Some(a.value),
"objecttype" => objecttype = Some(a.value)
"objecttype" => objecttype = Some(a.value),
"validstructs" => validstructs = Some(a.value),
}

if params.len() > 0 {
let validstructs = validstructs.map_or(
Default::default(),
|structs| structs.split(',').map(|s| s.to_owned()).collect()
);

if !params.is_empty() {
code.push_str(", ");
}
if let Some(definition) = parse_name_with_type(ctx, &mut code) {
Expand All @@ -691,6 +698,7 @@ fn parse_command<R: Read>(ctx: &mut ParseCtx<R>, attributes: Vec<XmlAttribute>)
noautovalidity,
objecttype,
definition,
validstructs,
});
}
},
Expand Down
10 changes: 10 additions & 0 deletions vk-parse/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,16 @@ pub struct CommandParam {
serde(default, skip_serializing_if = "is_default")
)]
pub definition: NameWithType,

/// only applicable for parameters which are pointers to `VkBaseInStructure` or
/// `VkBaseOutStructure` types, used as abstract placeholders. Specifies a list of structures
/// which may be passed in place of the parameter, or anywhere in the `pNext` chain of the
/// parameter.
#[cfg_attr(
feature = "serialize",
serde(default, skip_serializing_if = "is_default")
)]
pub validstructs: Vec<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Default)]
Expand Down