// Attempt to recreate a window's swapchain with the window's current dimensions.
Attempt to recreate a window's swapchain with the window's current dimensions.
Attempt to recreate a window ' s swapchain with the window ' s current dimensions .
fn recreate_window_swapchain(
    app: &App,
    window_id: window::Id,
) -> Result<(), vk::SwapchainCreationError> {
    let mut windows = app.windows.borrow_mut();
    let window = windows.get_mut(&window_id).expect("no window for id");
    // Get the new dimensions for the viewport/framebuffers.
    let dimensions = window
        .surface
        .capabilities(window.swapchain.device().physical_device())
        .expect("failed to get surface capabilities")
        .current_extent
        .expect("current_extent was `None`");
    // Recreate the swapchain with the current dimensions.
    let (new_swapchain, new_images) = window
        .swapchain
        .swapchain
        .recreate_with_dimension(dimensions)?;
    // Update the window's swapchain and images.
    window.replace_swapchain(new_swapchain, new_images);
    Ok(())
}
fn recreate_window_swapchain ( app : & App , window_id : window :: Id , ) -> Result < ( ) , vk :: SwapchainCreationError > { let mut windows = app . windows . borrow_mut ( ) ; let window = windows . get_mut ( & window_id ) . expect ( " " ) ; // Get the new dimensions for the viewport/framebuffers. let dimensions = window . surface . capabilities ( window . swapchain . device ( ) . physical_device ( ) ) . expect ( " " ) . current_extent . expect ( " " ) ; // Recreate the swapchain with the current dimensions. let ( new_swapchain , new_images ) = window . swapchain . swapchain . recreate_with_dimension ( dimensions ) ? ; // Update the window's swapchain and images. window . replace_swapchain ( new_swapchain , new_images ) ; Ok ( ( ) ) }
Attempt to recreate a window's swapchain with the window's current dimensions.
Attempt to recreate a window ' s swapchain with the window ' s current dimensions .
app
&App
window_id
window::Id