Fix overlay

This commit is contained in:
hodasemi 2023-12-06 13:53:31 +01:00
parent 171cedf181
commit 032dd8b043
2 changed files with 8 additions and 0 deletions

View file

@ -128,6 +128,12 @@ impl Overlay {
self.instances.remove(&handle);
}
pub fn remove_device(&mut self, handle: VkDevice) {
for instance_collection in self.instances.values_mut() {
instance_collection.device_collection.remove(&handle);
}
}
pub fn instance_by_physical_device(&self, physical_device: VkPhysicalDevice) -> Arc<Instance> {
match self
.instances
@ -360,6 +366,7 @@ impl Overlay {
self.rendering = Some(rendering);
self.gui_handler = Some(gui_handler);
self.rfactor_data = None;
write_log!("-> create rendering: end");

View file

@ -338,6 +338,7 @@ pub(crate) extern "system" fn destroy_device(
unsafe {
if let Some(vk_fn) = vk_handles().handle("vkDestroyDevice") {
let destroy_device: PFN_vkDestroyDevice = mem::transmute(vk_fn);
overlay().remove_device(device);
destroy_device(device, allocator);
}