it was that easy lol
This commit is contained in:
parent
4c11a8df82
commit
f8c14fc5d2
1 changed files with 18 additions and 5 deletions
|
@ -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::{util::Align, vk, Entry, Instance};
|
||||||
use ash_window::enumerate_required_extensions;
|
use ash_window::enumerate_required_extensions;
|
||||||
|
@ -82,11 +86,20 @@ impl Drop for RendererBackendManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct RendererBackend {
|
pub struct RendererBackend {
|
||||||
inner: VulkanWindowInner,
|
inner: ManuallyDrop<VulkanWindowInner>,
|
||||||
filter_chain: Option<FilterChain>,
|
filter_chain: ManuallyDrop<Option<FilterChain>>,
|
||||||
manager: Arc<RendererBackendManager>,
|
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 struct WindowOptions {
|
||||||
pub shader_path: Option<PathBuf>,
|
pub shader_path: Option<PathBuf>,
|
||||||
}
|
}
|
||||||
|
@ -119,8 +132,8 @@ impl RendererBackend {
|
||||||
});
|
});
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
inner,
|
inner: ManuallyDrop::new(inner),
|
||||||
filter_chain,
|
filter_chain: ManuallyDrop::new(filter_chain),
|
||||||
manager,
|
manager,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue