librashader/librashader-runtime-vk/src/hello_triangle/syncobjects.rs

24 lines
774 B
Rust
Raw Normal View History

2023-01-10 11:17:13 +11:00
use ash::prelude::VkResult;
use ash::vk;
pub struct SyncObjects {
pub image_available: vk::Semaphore,
pub render_finished: vk::Semaphore,
pub in_flight: vk::Fence
}
impl SyncObjects {
pub fn new(device: &ash::Device) -> VkResult<SyncObjects> {
unsafe {
let image_available = device.create_semaphore(&vk::SemaphoreCreateInfo::default(), None)?;
let render_finished = device.create_semaphore(&vk::SemaphoreCreateInfo::default(), None)?;
let in_flight = device.create_fence(&vk::FenceCreateInfo::builder().flags(vk::FenceCreateFlags::SIGNALED).build(), None)?;
Ok(SyncObjects {
image_available,
render_finished,
in_flight
})
}
}
}