it was that easy lol

This commit is contained in:
Alex Janka 2023-10-06 16:53:50 +11:00
parent 4c11a8df82
commit f8c14fc5d2

View file

@ -1,4 +1,8 @@
use std::{mem, path::PathBuf, sync::Arc};
use std::{
mem::{self, ManuallyDrop},
path::PathBuf,
sync::Arc,
};
use ash::{util::Align, vk, Entry, Instance};
use ash_window::enumerate_required_extensions;
@ -82,11 +86,20 @@ impl Drop for RendererBackendManager {
}
pub struct RendererBackend {
inner: VulkanWindowInner,
filter_chain: Option<FilterChain>,
inner: ManuallyDrop<VulkanWindowInner>,
filter_chain: ManuallyDrop<Option<FilterChain>>,
manager: Arc<RendererBackendManager>,
}
impl Drop for RendererBackend {
fn drop(&mut self) {
unsafe {
ManuallyDrop::drop(&mut self.filter_chain);
ManuallyDrop::drop(&mut self.inner);
}
}
}
pub struct WindowOptions {
pub shader_path: Option<PathBuf>,
}
@ -119,8 +132,8 @@ impl RendererBackend {
});
Self {
inner,
filter_chain,
inner: ManuallyDrop::new(inner),
filter_chain: ManuallyDrop::new(filter_chain),
manager,
}
}