// Recreate the window swapchain to match the loop mode.
Recreate the window swapchain to match the loop mode.
Recreate the window swapchain to match the loop mode .
fn change_loop_mode_for_window(window: &mut Window, loop_mode: &LoopMode) {
    let device = window.swapchain.swapchain.device().clone();
    let surface = window.surface.clone();
    let queue = window.queue.clone();
    // Initialise a swapchain builder from the current swapchain's params.
    let mut swapchain_builder =
        window::SwapchainBuilder::from_swapchain(&window.swapchain.swapchain);
    // Let the new present mode and image count be chosen by nannou or the user if
    // they have a preference.
    swapchain_builder.present_mode = window.user_specified_present_mode;
    swapchain_builder.image_count = window.user_specified_image_count;
    // Create the new swapchain.
    let (new_swapchain, new_swapchain_images) = swapchain_builder
        .build(
            device,
            surface,
            &queue,
            &loop_mode,
            None,
            Some(&window.swapchain.swapchain),
        )
        .expect("failed to recreate swapchain for new `LoopMode`");
    // Replace the window's swapchain with the newly created one.
    window.replace_swapchain(new_swapchain, new_swapchain_images);
}
fn change_loop_mode_for_window ( window : & mut Window , loop_mode : & LoopMode ) { let device = window . swapchain . swapchain . device ( ) . clone ( ) ; let surface = window . surface . clone ( ) ; let queue = window . queue . clone ( ) ; // Initialise a swapchain builder from the current swapchain's params. let mut swapchain_builder = window :: SwapchainBuilder :: from_swapchain ( & window . swapchain . swapchain ) ; // Let the new present mode and image count be chosen by nannou or the user if // they have a preference. swapchain_builder . present_mode = window . user_specified_present_mode ; swapchain_builder . image_count = window . user_specified_image_count ; // Create the new swapchain. let ( new_swapchain , new_swapchain_images ) = swapchain_builder . build ( device , surface , & queue , & loop_mode , None , Some ( & window . swapchain . swapchain ) , ) . expect ( " " ) ; // Replace the window's swapchain with the newly created one. window . replace_swapchain ( new_swapchain , new_swapchain_images ) ; }
Recreate the window swapchain to match the loop mode.
Recreate the window swapchain to match the loop mode .
window
&mut Window
loop_mode
&LoopMode