Fix: Some *const pointers should have been *mut pointers
This commit is contained in:
parent
2921a03638
commit
197b06b0d8
|
@ -85,9 +85,9 @@ impl<V: FunctionPointers> Instance<V> {
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub trait InstanceV1_1: InstanceV1_0 {
|
pub trait InstanceV1_1: InstanceV1_0 {
|
||||||
fn fp_v1_1(&self) -> &vk::InstanceFnV1_1;
|
fn fp_v1_1(&self) -> &vk::InstanceFnV1_1;
|
||||||
unsafe fn enumerate_instance_version(&self, api_version: &vk::uint32_t) -> vk::Result {
|
unsafe fn enumerate_instance_version(&self, api_version: &mut vk::uint32_t) -> vk::Result {
|
||||||
self.fp_v1_1()
|
self.fp_v1_1()
|
||||||
.enumerate_instance_version(api_version as *const _)
|
.enumerate_instance_version(api_version as *mut _)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
881
ash/src/vk.rs
881
ash/src/vk.rs
File diff suppressed because it is too large
Load diff
|
@ -556,14 +556,26 @@ pub trait FieldExt {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait ToTokens {
|
pub trait ToTokens {
|
||||||
fn to_tokens(&self) -> Tokens;
|
fn to_tokens(&self, is_const: bool) -> Tokens;
|
||||||
}
|
}
|
||||||
impl ToTokens for vkxml::ReferenceType {
|
impl ToTokens for vkxml::ReferenceType {
|
||||||
fn to_tokens(&self) -> Tokens {
|
fn to_tokens(&self, is_const: bool) -> Tokens {
|
||||||
let ptr_name = match self {
|
let ptr_name = match self {
|
||||||
vkxml::ReferenceType::Pointer => "*const",
|
vkxml::ReferenceType::Pointer => {
|
||||||
|
if is_const {
|
||||||
|
"*const"
|
||||||
|
} else {
|
||||||
|
"*mut"
|
||||||
|
}
|
||||||
|
}
|
||||||
vkxml::ReferenceType::PointerToPointer => "*mut *mut",
|
vkxml::ReferenceType::PointerToPointer => "*mut *mut",
|
||||||
vkxml::ReferenceType::PointerToConstPointer => "*const *const",
|
vkxml::ReferenceType::PointerToConstPointer => {
|
||||||
|
if is_const {
|
||||||
|
"*const *const"
|
||||||
|
} else {
|
||||||
|
"*mut *const"
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
let ident = Term::intern(ptr_name);
|
let ident = Term::intern(ptr_name);
|
||||||
quote!{
|
quote!{
|
||||||
|
@ -591,7 +603,7 @@ fn name_to_tokens(type_name: &str) -> Ident {
|
||||||
}
|
}
|
||||||
fn to_type_tokens(type_name: &str, reference: Option<&vkxml::ReferenceType>) -> Tokens {
|
fn to_type_tokens(type_name: &str, reference: Option<&vkxml::ReferenceType>) -> Tokens {
|
||||||
let new_name = name_to_tokens(type_name);
|
let new_name = name_to_tokens(type_name);
|
||||||
let ptr_name = reference.map(|r| r.to_tokens()).unwrap_or(quote!{});
|
let ptr_name = reference.map(|r| r.to_tokens(false)).unwrap_or(quote!{});
|
||||||
quote!{#ptr_name #new_name}
|
quote!{#ptr_name #new_name}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -609,11 +621,12 @@ impl FieldExt for vkxml::Field {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn type_tokens(&self) -> Tokens {
|
fn type_tokens(&self) -> Tokens {
|
||||||
|
println!("{:#?}", self);
|
||||||
let ty = name_to_tokens(&self.basetype);
|
let ty = name_to_tokens(&self.basetype);
|
||||||
let pointer = self
|
let pointer = self
|
||||||
.reference
|
.reference
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|r| r.to_tokens())
|
.map(|r| r.to_tokens(self.is_const))
|
||||||
.unwrap_or(quote!{});
|
.unwrap_or(quote!{});
|
||||||
let pointer_ty = quote!{
|
let pointer_ty = quote!{
|
||||||
#pointer #ty
|
#pointer #ty
|
||||||
|
|
Loading…
Reference in a new issue