pub fn return_frame(&mut self, mut frame: Frame) -> Result<()> {
        let image_acquired_semaphore = self.current_image_acquired_semaphore;
        let render_finished_semaphore =
            frame.finish_frame(image_acquired_semaphore)?;
        self.frames_in_flight[self.current_frame_index] = Some(frame);

        let render_finished_semaphores = &[render_finished_semaphore];
        let swapchains = [self.swapchain.swapchain];
        let indices = [self.current_frame_index as u32];

        let present_info = vk::PresentInfoKHR {
            p_wait_semaphores: render_finished_semaphores.as_ptr(),
            wait_semaphore_count: render_finished_semaphores.len() as u32,
            p_swapchains: swapchains.as_ptr(),
            swapchain_count: swapchains.len() as u32,
            p_image_indices: indices.as_ptr(),
            ..Default::default()
        };

        let result = unsafe {
            self.swapchain
                .swapchain_loader
                .queue_present(self.device.present_queue.raw(), &present_info)
        };
        if Err(vk::Result::ERROR_OUT_OF_DATE_KHR) == result {
            self.swapchain_state = SwapchainState::NeedsRebuild;
        }

        Ok(())
    }
/// Complete the current frame and present the framebuffer.
Complete the current frame and present the framebuffer.
Complete the current frame and present the framebuffer .
pub fn return_frame(&mut self, mut frame: Frame) -> Result<()> {
        let image_acquired_semaphore = self.current_image_acquired_semaphore;
        let render_finished_semaphore =
            frame.finish_frame(image_acquired_semaphore)?;
        self.frames_in_flight[self.current_frame_index] = Some(frame);
        let render_finished_semaphores = &[render_finished_semaphore];
        let swapchains = [self.swapchain.swapchain];
        let indices = [self.current_frame_index as u32];
        let present_info = vk::PresentInfoKHR {
            p_wait_semaphores: render_finished_semaphores.as_ptr(),
            wait_semaphore_count: render_finished_semaphores.len() as u32,
            p_swapchains: swapchains.as_ptr(),
            swapchain_count: swapchains.len() as u32,
            p_image_indices: indices.as_ptr(),
            ..Default::default()
        };
        let result = unsafe {
            self.swapchain
                .swapchain_loader
                .queue_present(self.device.present_queue.raw(), &present_info)
        };
        if Err(vk::Result::ERROR_OUT_OF_DATE_KHR) == result {
            self.swapchain_state = SwapchainState::NeedsRebuild;
        }
        Ok(())
    }
pub fn return_frame ( & mut self , mut frame : Frame ) -> Result < ( ) > { let image_acquired_semaphore = self . current_image_acquired_semaphore ; let render_finished_semaphore = frame . finish_frame ( image_acquired_semaphore ) ? ; self . frames_in_flight [ self . current_frame_index ] = Some ( frame ) ; let render_finished_semaphores = & [ render_finished_semaphore ] ; let swapchains = [ self . swapchain . swapchain ] ; let indices = [ self . current_frame_index as u32 ] ; let present_info = vk :: PresentInfoKHR { p_wait_semaphores : render_finished_semaphores . as_ptr ( ) , wait_semaphore_count : render_finished_semaphores . len ( ) as u32 , p_swapchains : swapchains . as_ptr ( ) , swapchain_count : swapchains . len ( ) as u32 , p_image_indices : indices . as_ptr ( ) , .. Default :: default ( ) } ; let result = unsafe { self . swapchain . swapchain_loader . queue_present ( self . device . present_queue . raw ( ) , & present_info ) } ; if Err ( vk :: Result :: ERROR_OUT_OF_DATE_KHR ) == result { self . swapchain_state = SwapchainState :: NeedsRebuild ; } Ok ( ( ) ) }
Complete the current frame and present the framebuffer.
Complete the current frame and present the framebuffer .
&mut self
frame
Frame