/// Selects the resolution of the swap chain images.
/// This is almost always equal to the resolution of the Surface we're drawing
/// too, but we need to double check since some window managers allow us to
/// differ.
Selects the resolution of the swap chain images.
This is almost always equal to the resolution of the Surface we're drawing
too, but we need to double check since some window managers allow us to
differ.
Selects the resolution of the swap chain images . This is almost always equal to the resolution of the Surface we ' re drawing too but we need to double check since some window managers allow us to differ .
fn choose_swap_extent(
    capabilities: &vk::SurfaceCapabilitiesKHR, requested_width: u32, requested_height: u32,
  ) -> vk::Extent2D {
    if capabilities.current_extent.width != u32::max_value() {
      return capabilities.current_extent;
    }
    // The window system indicates that we can specify our own extent if this is
    // true
    let clipped_requested_width = requested_width.min(capabilities.max_image_extent.width);
    let width = capabilities
      .min_image_extent
      .width
      .max(clipped_requested_width);
    let clipped_requested_height = requested_height.min(capabilities.max_image_extent.height);
    let height = capabilities
      .min_image_extent
      .height
      .max(clipped_requested_height);
    if width != requested_width || height != requested_height {
      warn!(
        "Could not create a swapchain with the requested height and width, rendering to a \
         resolution of {}x{} instead",
        width, height
      );
    }
    vk::Extent2D::builder().width(width).height(height).build()
  }
fn choose_swap_extent ( capabilities : & vk :: SurfaceCapabilitiesKHR , requested_width : u32 , requested_height : u32 , ) -> vk :: Extent2D { if capabilities . current_extent . width != u32 :: max_value ( ) { return capabilities . current_extent ; } // The window system indicates that we can specify our own extent if this is // true let clipped_requested_width = requested_width . min ( capabilities . max_image_extent . width ) ; let width = capabilities . min_image_extent . width . max ( clipped_requested_width ) ; let clipped_requested_height = requested_height . min ( capabilities . max_image_extent . height ) ; let height = capabilities . min_image_extent . height . max ( clipped_requested_height ) ; if width != requested_width || height != requested_height { warn ! ( " \
 " width height ) ; } vk :: Extent2D :: builder ( ) . width ( width ) . height ( height ) . build ( ) }
Selects the resolution of the swap chain images.
Selects the resolution of the swap chain images .
capabilities
&vk::SurfaceCapabilitiesKHR
requested_width
u32
requested_height
u32