Fix result access
This commit is contained in:
parent
9130e0d8df
commit
c54b4c1c24
2 changed files with 9 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
|||
use crate::prelude::*;
|
||||
use crate::structs::raw_to_slice;
|
||||
use crate::structs::{raw_to_slice, raw_to_slice_mut};
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use std::ptr;
|
||||
|
@ -74,11 +74,11 @@ impl VkPresentInfoKHR {
|
|||
swapchain_infos
|
||||
}
|
||||
|
||||
pub fn results(&self) -> &[VkResult] {
|
||||
if self.waitSemaphoreCount == 0 || self.pResults != ptr::null_mut() {
|
||||
&[]
|
||||
pub fn results(&mut self) -> &mut [VkResult] {
|
||||
if self.swapchainCount == 0 || self.pResults != ptr::null_mut() {
|
||||
&mut []
|
||||
} else {
|
||||
raw_to_slice(self.pResults, self.waitSemaphoreCount)
|
||||
raw_to_slice_mut(self.pResults, self.swapchainCount)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,3 +21,7 @@ use std::slice;
|
|||
fn raw_to_slice<'a, T: Clone>(pointer: *const T, size: u32) -> &'a [T] {
|
||||
unsafe { slice::from_raw_parts(pointer, size as usize) }
|
||||
}
|
||||
|
||||
fn raw_to_slice_mut<'a, T: Clone>(pointer: *mut T, size: u32) -> &'a mut [T] {
|
||||
unsafe { slice::from_raw_parts_mut(pointer, size as usize) }
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue