pub fn present(&self, image_index: u32) {
        let swapchains = unsafe { [(*self.swapchain.get()).swapchain] };
        let img_indices = [image_index];
        let present_info = vk::PresentInfoKHR::builder()
            // no wait semaphores needed
            .wait_semaphores(&[])
            .swapchains(&swapchains)
            .image_indices(&img_indices);

        // queue image for presentation
        unsafe {
            if let Err(e) = (*self.swapchain.get())
                .entry
                .queue_present(self.device.queues.presentation, &present_info)
            {
                // handle swapchain not matching surface (due to window resize)
                if e == vk::Result::ERROR_OUT_OF_DATE_KHR || e == vk::Result::SUBOPTIMAL_KHR {
                    self.recreate_swapchain()
                        .expect("failed to recreate swapchain in render_frame()");
                }
            }
        }

        // wait for presentation to finish
        unsafe {
            self.device
                .logical
                .queue_wait_idle(self.device.queues.presentation)
                .expect("failed to wait for presentation to finish in present()")
        };
    }
// presents the image corresponding to image_index.
presents the image corresponding to image_index.
presents the image corresponding to image_index .
pub fn present(&self, image_index: u32) {
        let swapchains = unsafe { [(*self.swapchain.get()).swapchain] };
        let img_indices = [image_index];
        let present_info = vk::PresentInfoKHR::builder()
            // no wait semaphores needed
            .wait_semaphores(&[])
            .swapchains(&swapchains)
            .image_indices(&img_indices);
        // queue image for presentation
        unsafe {
            if let Err(e) = (*self.swapchain.get())
                .entry
                .queue_present(self.device.queues.presentation, &present_info)
            {
                // handle swapchain not matching surface (due to window resize)
                if e == vk::Result::ERROR_OUT_OF_DATE_KHR || e == vk::Result::SUBOPTIMAL_KHR {
                    self.recreate_swapchain()
                        .expect("failed to recreate swapchain in render_frame()");
                }
            }
        }
        // wait for presentation to finish
        unsafe {
            self.device
                .logical
                .queue_wait_idle(self.device.queues.presentation)
                .expect("failed to wait for presentation to finish in present()")
        };
    }
pub fn present ( & self , image_index : u32 ) { let swapchains = unsafe { [ ( * self . swapchain . get ( ) ) . swapchain ] } ; let img_indices = [ image_index ] ; let present_info = vk :: PresentInfoKHR :: builder ( ) // no wait semaphores needed . wait_semaphores ( & [ ] ) . swapchains ( & swapchains ) . image_indices ( & img_indices ) ; // queue image for presentation unsafe { if let Err ( e ) = ( * self . swapchain . get ( ) ) . entry . queue_present ( self . device . queues . presentation , & present_info ) { // handle swapchain not matching surface (due to window resize) if e == vk :: Result :: ERROR_OUT_OF_DATE_KHR || e == vk :: Result :: SUBOPTIMAL_KHR { self . recreate_swapchain ( ) . expect ( " " ) ; } } } // wait for presentation to finish unsafe { self . device . logical . queue_wait_idle ( self . device . queues . presentation ) . expect ( " " ) } ; }
presents the image corresponding to image_index.
presents the image corresponding to image_index .
&self
image_index
u32
&self
image_index
u32