Separate getters for vectors into two functions
One is safe, used to determine how many structures will be returned. The other is unsafe, and takes in a mutable reference to an array of structure chains.
This commit is contained in:
parent
53161660ef
commit
0c26422215
|
@ -151,10 +151,10 @@ pub trait InstanceV1_1: InstanceV1_0 {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_physical_device_queue_family_properties2(
|
||||
fn get_physical_device_queue_family_properties2_len(
|
||||
&self,
|
||||
physical_device: vk::PhysicalDevice,
|
||||
) -> Vec<vk::QueueFamilyProperties2> {
|
||||
) -> usize {
|
||||
unsafe {
|
||||
let mut queue_count = 0;
|
||||
self.fp_v1_1().get_physical_device_queue_family_properties2(
|
||||
|
@ -162,15 +162,21 @@ pub trait InstanceV1_1: InstanceV1_0 {
|
|||
&mut queue_count,
|
||||
ptr::null_mut(),
|
||||
);
|
||||
let mut queue_families_vec = Vec::with_capacity(queue_count as usize);
|
||||
queue_count as usize
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn get_physical_device_queue_family_properties2(
|
||||
&self,
|
||||
physical_device: vk::PhysicalDevice,
|
||||
queue_family_props: &mut [vk::QueueFamilyProperties2]
|
||||
) {
|
||||
let mut queue_count = queue_family_props.len() as u32;
|
||||
self.fp_v1_1().get_physical_device_queue_family_properties2(
|
||||
physical_device,
|
||||
&mut queue_count,
|
||||
queue_families_vec.as_mut_ptr(),
|
||||
queue_family_props.as_mut_ptr(),
|
||||
);
|
||||
queue_families_vec.set_len(queue_count as usize);
|
||||
queue_families_vec
|
||||
}
|
||||
}
|
||||
|
||||
fn get_physical_device_memory_properties2(
|
||||
|
|
Loading…
Reference in a new issue