fn recreate_swapchain(&mut self, ctx: ContextView<'_>) {
        log::info!("Recreating swapchain.");

        self.vd.device_wait_idle();

        let window = unsafe { ctx.get_resource_unchecked::<Window>() };
        let extent = window.framebuffer_size();

        let new_swapchain = Swapchain::new(self.vd.clone(), Some(self.swapchain.object()), extent);

        self.swapchain = new_swapchain;

        // Wait until all command buffers have been finished.
        while let Some(submitted) = self.submitted_command_buffers.pop_front() {
            if let Ok(VkSuccess::NotReady) = self.vd.get_fence_status(submitted.complete_fence()) {
                self.vd
                    .wait_for_fences(&[submitted.complete_fence()], true, u64::MAX)
                    .unwrap();
            }

            self.vd.reset_fences(&[submitted.complete_fence()]).unwrap();
            self.free_command_buffers
                .push_back(submitted.clone())
                .unwrap();
        }
    }
/// Recreate the swapchain when Vulkan complains about it.
Recreate the swapchain when Vulkan complains about it.
Recreate the swapchain when Vulkan complains about it .
fn recreate_swapchain(&mut self, ctx: ContextView<'_>) {
        log::info!("Recreating swapchain.");
        self.vd.device_wait_idle();
        let window = unsafe { ctx.get_resource_unchecked::<Window>() };
        let extent = window.framebuffer_size();
        let new_swapchain = Swapchain::new(self.vd.clone(), Some(self.swapchain.object()), extent);
        self.swapchain = new_swapchain;
        // Wait until all command buffers have been finished.
        while let Some(submitted) = self.submitted_command_buffers.pop_front() {
            if let Ok(VkSuccess::NotReady) = self.vd.get_fence_status(submitted.complete_fence()) {
                self.vd
                    .wait_for_fences(&[submitted.complete_fence()], true, u64::MAX)
                    .unwrap();
            }
            self.vd.reset_fences(&[submitted.complete_fence()]).unwrap();
            self.free_command_buffers
                .push_back(submitted.clone())
                .unwrap();
        }
    }
fn recreate_swapchain ( & mut self , ctx : ContextView < ' _ > ) { log :: info ! ( " " ) ; self . vd . device_wait_idle ( ) ; let window = unsafe { ctx . get_resource_unchecked :: < Window > ( ) } ; let extent = window . framebuffer_size ( ) ; let new_swapchain = Swapchain :: new ( self . vd . clone ( ) , Some ( self . swapchain . object ( ) ) , extent ) ; self . swapchain = new_swapchain ; // Wait until all command buffers have been finished. while let Some ( submitted ) = self . submitted_command_buffers . pop_front ( ) { if let Ok ( VkSuccess :: NotReady ) = self . vd . get_fence_status ( submitted . complete_fence ( ) ) { self . vd . wait_for_fences ( & [ submitted . complete_fence ( ) ] , true , u64 :: MAX ) . unwrap ( ) ; } self . vd . reset_fences ( & [ submitted . complete_fence ( ) ] ) . unwrap ( ) ; self . free_command_buffers . push_back ( submitted . clone ( ) ) . unwrap ( ) ; } }
Recreate the swapchain when Vulkan complains about it.
Recreate the swapchain when Vulkan complains about it .
&mut self
ctx
ContextView<'_>
&mut self
ctx
ContextView<'_>