Improve present info
This commit is contained in:
parent
f08c63b0c2
commit
f318ae03fd
1 changed files with 40 additions and 0 deletions
|
@ -1,8 +1,14 @@
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
use crate::structs::raw_to_slice;
|
||||||
|
|
||||||
use std::os::raw::c_void;
|
use std::os::raw::c_void;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
|
pub struct PresentInfoSwapchain {
|
||||||
|
pub swapchain: VkSwapchainKHR,
|
||||||
|
pub index: u32,
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct VkPresentInfoKHR {
|
pub struct VkPresentInfoKHR {
|
||||||
|
@ -41,4 +47,38 @@ impl VkPresentInfoKHR {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn wait_semaphores(&self) -> &[VkSemaphore] {
|
||||||
|
if self.waitSemaphoreCount == 0 {
|
||||||
|
&[]
|
||||||
|
} else {
|
||||||
|
raw_to_slice(self.pWaitSemaphores, self.waitSemaphoreCount)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn swapchain_info(&self) -> Vec<PresentInfoSwapchain> {
|
||||||
|
let mut swapchain_infos = Vec::with_capacity(self.swapchainCount as usize);
|
||||||
|
|
||||||
|
if self.swapchainCount != 0 {
|
||||||
|
let swapchains = raw_to_slice(self.pSwapchains, self.swapchainCount);
|
||||||
|
let indices = raw_to_slice(self.pImageIndices, self.swapchainCount);
|
||||||
|
|
||||||
|
for i in 0..(self.swapchainCount as usize) {
|
||||||
|
swapchain_infos.push(PresentInfoSwapchain {
|
||||||
|
swapchain: swapchains[i],
|
||||||
|
index: indices[i],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
swapchain_infos
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn results(&self) -> &[VkResult] {
|
||||||
|
if self.waitSemaphoreCount == 0 || self.pResults != ptr::null_mut() {
|
||||||
|
&[]
|
||||||
|
} else {
|
||||||
|
raw_to_slice(self.pResults, self.waitSemaphoreCount)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue