Don't implement Default for handles
This commit is contained in:
parent
37f9f98297
commit
7201e78674
|
@ -850,10 +850,12 @@ pub fn generate_extension<'a>(
|
||||||
cmd_map: &CommandMap,
|
cmd_map: &CommandMap,
|
||||||
const_cache: &mut HashSet<&'a str>,
|
const_cache: &mut HashSet<&'a str>,
|
||||||
) -> Option<quote::Tokens> {
|
) -> Option<quote::Tokens> {
|
||||||
// let _ = extension
|
// Okay this is a little bit odd. We need to generate all extensions, even disabled ones,
|
||||||
// .supported
|
// because otherwise some StructureTypes won't get generated. But we don't generate extensions
|
||||||
// .as_ref()
|
// that are reserved
|
||||||
// .filter(|s| s.as_str() == "vulkan")?;
|
if extension.name.contains("RESERVED") {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
let extension_tokens = generate_extension_constants(
|
let extension_tokens = generate_extension_constants(
|
||||||
&extension.name,
|
&extension.name,
|
||||||
extension.number.unwrap_or(0),
|
extension.number.unwrap_or(0),
|
||||||
|
@ -1078,6 +1080,9 @@ pub fn derive_default(_struct: &vkxml::Struct, union_types: &HashSet<&str>) -> O
|
||||||
};
|
};
|
||||||
let contains_pfn = members.clone().any(is_pfn);
|
let contains_pfn = members.clone().any(is_pfn);
|
||||||
|
|
||||||
|
// This are also pointers, and therefor also don't implement Default. The spec
|
||||||
|
// also doesn't mark them as pointers
|
||||||
|
let handles = ["LPCWSTR", "HANDLE", "HINSTANCE", "HWND"];
|
||||||
let contains_ptr = members.clone().any(|field| field.reference.is_some());
|
let contains_ptr = members.clone().any(|field| field.reference.is_some());
|
||||||
let contains_strucutre_type = members.clone().any(is_structure_type);
|
let contains_strucutre_type = members.clone().any(is_structure_type);
|
||||||
let contains_static_array = members.clone().any(is_static_array);
|
let contains_static_array = members.clone().any(is_static_array);
|
||||||
|
@ -1102,7 +1107,11 @@ pub fn derive_default(_struct: &vkxml::Struct, union_types: &HashSet<&str>) -> O
|
||||||
#param_ident: unsafe { ::std::mem::zeroed() }
|
#param_ident: unsafe { ::std::mem::zeroed() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if field.reference.is_some() || is_static_array(field) || is_pfn(field) {
|
} else if field.reference.is_some()
|
||||||
|
|| is_static_array(field)
|
||||||
|
|| is_pfn(field)
|
||||||
|
|| handles.contains(&field.basetype.as_str())
|
||||||
|
{
|
||||||
quote!{
|
quote!{
|
||||||
#param_ident: unsafe { ::std::mem::zeroed() }
|
#param_ident: unsafe { ::std::mem::zeroed() }
|
||||||
}
|
}
|
||||||
|
@ -1403,13 +1412,8 @@ pub fn write_source_code(path: &Path) {
|
||||||
})
|
})
|
||||||
.nth(0)
|
.nth(0)
|
||||||
.expect("extension");
|
.expect("extension");
|
||||||
spec2.0.iter().for_each(|item| match item {
|
|
||||||
vk_parse::RegistryItem::Enums { name, .. } => println!("{:?}", name),
|
|
||||||
_ => (),
|
|
||||||
});
|
|
||||||
|
|
||||||
let spec = vk_parse::parse_file_as_vkxml(path);
|
let spec = vk_parse::parse_file_as_vkxml(path);
|
||||||
//println!("{:#?}", spec);
|
|
||||||
let commands: HashMap<vkxml::Identifier, &vkxml::Command> = spec
|
let commands: HashMap<vkxml::Identifier, &vkxml::Command> = spec
|
||||||
.elements
|
.elements
|
||||||
.iter()
|
.iter()
|
||||||
|
|
Loading…
Reference in a new issue