fn aquire_swapchain_image_and_render(
        &self,
        resources: &Resources,
        world: &World,
        window: &dyn Window,
    ) -> VkResult<()> {
        // Fetch the next swapchain image
        let frame_in_flight = {
            let mut surface = resources.get_mut::<VkSurface>().unwrap();
            let t0 = std::time::Instant::now();
            let result = surface.acquire_next_swapchain_image(window);
            let t1 = std::time::Instant::now();
            log::trace!(
                "[main] wait for swapchain image took {} ms",
                (t1 - t0).as_secs_f32() * 1000.0
            );
            result?
        };

        // After this point, any failures will be deferred to handle in next frame
        Self::create_and_start_render_job(self, world, resources, window, frame_in_flight);
        Ok(())
    }
//TODO: In a failure, return the frame_in_flight and cancel the render. This will make
// previous_frame_result unnecessary
In a failure, return the frame_in_flight and cancel the render. This will make
previous_frame_result unnecessary
In a failure return the frame_in_flight and cancel the render . This will make previous_frame_result unnecessary
fn aquire_swapchain_image_and_render(
        &self,
        resources: &Resources,
        world: &World,
        window: &dyn Window,
    ) -> VkResult<()> {
        // Fetch the next swapchain image
        let frame_in_flight = {
            let mut surface = resources.get_mut::<VkSurface>().unwrap();
            let t0 = std::time::Instant::now();
            let result = surface.acquire_next_swapchain_image(window);
            let t1 = std::time::Instant::now();
            log::trace!(
                "[main] wait for swapchain image took {} ms",
                (t1 - t0).as_secs_f32() * 1000.0
            );
            result?
        };
        // After this point, any failures will be deferred to handle in next frame
        Self::create_and_start_render_job(self, world, resources, window, frame_in_flight);
        Ok(())
    }
fn aquire_swapchain_image_and_render ( & self , resources : & Resources , world : & World , window : & dyn Window , ) -> VkResult < ( ) > { // Fetch the next swapchain image let frame_in_flight = { let mut surface = resources . get_mut :: < VkSurface > ( ) . unwrap ( ) ; let t0 = std :: time :: Instant :: now ( ) ; let result = surface . acquire_next_swapchain_image ( window ) ; let t1 = std :: time :: Instant :: now ( ) ; log :: trace ! ( " " ( t1 t0 ) as_secs_f32 ( ) 1000.0 ) ; result ? } ; // After this point, any failures will be deferred to handle in next frame Self :: create_and_start_render_job ( self , world , resources , window , frame_in_flight ) ; Ok ( ( ) ) }
TODO: In a failure, return the frame_in_flight and cancel the render.
TODO : In a failure return the frame_in_flight and cancel the render .
&self
resources
&Resources
world
&World
window
&dyn Window
&self
resources
&Resources
world
&World
window
&dyn Window