// Acquire the next swapchain image for the given window and draw to it using the user's
// view function.
//
// Returns whether or not `view_frame` was called. This will be `false` if the given window
// no longer exists or if the swapchain is `OutOfDate` and needs recreation by the time
// `acquire_next_image` is called.
Acquire the next swapchain image for the given window and draw to it using the user's
view function.

Returns whether or not `view_frame` was called.
Acquire the next swapchain image for the given window and draw to it using the user ' s view function . Returns whether or not ` view_frame ` was called .
fn acquire_image_and_view_frame<M>(
    app: &mut App,
    window_id: window::Id,
    model: &M,
    view: Option<&View<M>>,
) -> bool
where
    M: 'static,
{
    // Skip closed windows.
    if app.window(window_id).is_none() {
        return false;
    }
    cleanup_unused_gpu_resources_for_window(app, window_id);
    // Ensure swapchain dimensions are up to date.
    loop {
        if window_swapchain_needs_recreation(app, window_id) {
            match recreate_window_swapchain(app, window_id) {
                Ok(()) => break,
                Err(vk::SwapchainCreationError::UnsupportedDimensions) => {
                    set_window_swapchain_needs_recreation(app, window_id, true);
                    continue;
                }
                Err(err) => panic!("{:?}", err),
            }
        }
        break;
    }
    // Acquire the next image from the swapchain.
    let timeout = None;
    let swapchain = app.windows.borrow()[&window_id].swapchain.clone();
    let next_img = vk::swapchain::acquire_next_image(swapchain.swapchain.clone(), timeout);
    let (swapchain_image_index, swapchain_image_acquire_future) = match next_img {
        Ok(r) => r,
        Err(vk::swapchain::AcquireError::OutOfDate) => {
            set_window_swapchain_needs_recreation(app, window_id, true);
            return false;
        }
        Err(err) => panic!("{:?}", err),
    };
    view_frame(
        app,
        model,
        window_id,
        swapchain_image_index,
        swapchain_image_acquire_future,
        view,
    );
    true
}
fn acquire_image_and_view_frame < M > ( app : & mut App , window_id : window :: Id , model : & M , view : Option < & View < M > > , ) -> bool where M : ' static , { // Skip closed windows. if app . window ( window_id ) . is_none ( ) { return false ; } cleanup_unused_gpu_resources_for_window ( app , window_id ) ; // Ensure swapchain dimensions are up to date. loop { if window_swapchain_needs_recreation ( app , window_id ) { match recreate_window_swapchain ( app , window_id ) { Ok ( ( ) ) => break , Err ( vk :: SwapchainCreationError :: UnsupportedDimensions ) => { set_window_swapchain_needs_recreation ( app , window_id , true ) ; continue ; } Err ( err ) => panic ! ( " " err ) , } } break ; } // Acquire the next image from the swapchain. let timeout = None ; let swapchain = app . windows . borrow ( ) [ & window_id ] . swapchain . clone ( ) ; let next_img = vk :: swapchain :: acquire_next_image ( swapchain . swapchain . clone ( ) , timeout ) ; let ( swapchain_image_index , swapchain_image_acquire_future ) = match next_img { Ok ( r ) => r , Err ( vk :: swapchain :: AcquireError :: OutOfDate ) => { set_window_swapchain_needs_recreation ( app , window_id , true ) ; return false ; } Err ( err ) => panic ! ( " " err ) , } ; view_frame ( app , model , window_id , swapchain_image_index , swapchain_image_acquire_future , view , ) ; true }
Acquire the next swapchain image for the given window and draw to it using the user's
view function.
Acquire the next swapchain image for the given window and draw to it using the user ' s view function .
app
&mut App
window_id
window::Id
model
&M
view
Option<&View<M>>