pub fn choose_surface_format(
    window_surface: &dyn WindowSurface,
    physical_device: &vk::PhysicalDevice,
) -> vk::SurfaceFormatKHR {
    //! checking formats is safe because support for the swapchain extension is
    //! verified when picking a physical device
    let formats = unsafe { window_surface.supported_formats(physical_device) };

    log::info!("available formats {:?}", formats);

    let format = formats
        .iter()
        .cloned()
        .find(|format| {
            format.color_space == vk::ColorSpaceKHR::SRGB_NONLINEAR
                && format.format == vk::Format::B8G8R8A8_SRGB
        })
        .unwrap_or_else(|| formats[0]);

    log::info!("chosen format {:?}", format);

    format
}
/// Choose a surface format for the swapchain based on the window and chosen
/// physical device.
///
Choose a surface format for the swapchain based on the window and chosen
physical device.
Choose a surface format for the swapchain based on the window and chosen physical device .
pub fn choose_surface_format(
    window_surface: &dyn WindowSurface,
    physical_device: &vk::PhysicalDevice,
) -> vk::SurfaceFormatKHR {
    //! checking formats is safe because support for the swapchain extension is
    //! verified when picking a physical device
    let formats = unsafe { window_surface.supported_formats(physical_device) };
    log::info!("available formats {:?}", formats);
    let format = formats
        .iter()
        .cloned()
        .find(|format| {
            format.color_space == vk::ColorSpaceKHR::SRGB_NONLINEAR
                && format.format == vk::Format::B8G8R8A8_SRGB
        })
        .unwrap_or_else(|| formats[0]);
    log::info!("chosen format {:?}", format);
    format
}
pub fn choose_surface_format ( window_surface : & dyn WindowSurface , physical_device : & vk :: PhysicalDevice , ) -> vk :: SurfaceFormatKHR { //! checking formats is safe because support for the swapchain extension is //! verified when picking a physical device let formats = unsafe { window_surface . supported_formats ( physical_device ) } ; log :: info ! ( " " formats ) ; let format = formats . iter ( ) . cloned ( ) . find ( | format | { format . color_space == vk :: ColorSpaceKHR :: SRGB_NONLINEAR && format . format == vk :: Format :: B8G8R8A8_SRGB } ) . unwrap_or_else ( | | formats [ 0 ] ) ; log :: info ! ( " " format ) ; format }
Choose a surface format for the swapchain based on the window and chosen
physical device.
Choose a surface format for the swapchain based on the window and chosen physical device .
window_surface
&dyn WindowSurface
physical_device
&vk::PhysicalDevice