vulkan: Move to renderer module

This commit is contained in:
Florian RICHER 2024-11-27 20:59:39 +01:00
parent 001547dbc2
commit a669247406
Signed by: florian.richer
GPG key ID: C73D37CBED7BFC77
21 changed files with 61 additions and 63 deletions

View file

@ -0,0 +1,29 @@
use super::VkDevice;
use ash::vk;
use std::sync::Arc;
pub struct VkSemaphore {
device: Arc<VkDevice>,
pub(super) handle: vk::Semaphore,
}
impl VkSemaphore {
pub fn new(device: &Arc<VkDevice>) -> anyhow::Result<Self> {
let semaphore_info = vk::SemaphoreCreateInfo::default();
let semaphore = unsafe { device.handle.create_semaphore(&semaphore_info, None)? };
log::debug!("Semaphore created ({semaphore:?})");
Ok(Self {
device: device.clone(),
handle: semaphore,
})
}
}
impl Drop for VkSemaphore {
fn drop(&mut self) {
unsafe { self.device.handle.destroy_semaphore(self.handle, None) };
log::debug!("Semaphore destroyed ({:?})", self.handle);
}
}