fn pick_physical_device(
    instance: &Instance, surface_and_extension: &SurfaceAndExtension, msaa_conifg: &MsaaConfig,
  ) -> SarektResult<vk::PhysicalDevice> {
    let available_physical_devices = unsafe {
      instance
        .enumerate_physical_devices()
        .expect("Unable to enumerate physical devices")
    };

    // Assign some rank to all devices and get the highest one.
    let mut suitable_devices_ranked: Vec<_> = available_physical_devices
      .into_iter()
      .map(|device| Self::rank_device(instance, device, surface_and_extension))
      .filter(|&(_, rank)| rank > -1i32)
      .collect();
    suitable_devices_ranked.sort_by(|&(_, l_rank), &(_, r_rank)| l_rank.cmp(&r_rank));

    info!(
      "Physical Devices most to least desirable:\n\t{:?}",
      suitable_devices_ranked
    );

    let physical_device = suitable_devices_ranked
      .first()
      .map(|&(device, _)| device)
      .ok_or(SarektError::CouldNotSelectPhysicalDevice(
        "No compatible device",
      ))?;

    if !Self::aaconfig_compatible(instance, physical_device, msaa_conifg)? {
      return Err(SarektError::CouldNotSelectPhysicalDevice(
        "AA mode not compatible",
      ));
    }

    Ok(physical_device)
  }
// ================================================================================
//  Physical Device Helper Methods
// ================================================================================
/// Evaluates all the available physical devices in the system and picks the
/// best one based on a heuristic.
///
/// TODO(issue#18) CONFIG have this be overridable somehow with config etc.
Physical Device Helper Methods
Evaluates all the available physical devices in the system and picks the
best one based on a heuristic.


Physical Device Helper Methods Evaluates all the available physical devices in the system and picks the best one based on a heuristic .
fn pick_physical_device(
    instance: &Instance, surface_and_extension: &SurfaceAndExtension, msaa_conifg: &MsaaConfig,
  ) -> SarektResult<vk::PhysicalDevice> {
    let available_physical_devices = unsafe {
      instance
        .enumerate_physical_devices()
        .expect("Unable to enumerate physical devices")
    };
    // Assign some rank to all devices and get the highest one.
    let mut suitable_devices_ranked: Vec<_> = available_physical_devices
      .into_iter()
      .map(|device| Self::rank_device(instance, device, surface_and_extension))
      .filter(|&(_, rank)| rank > -1i32)
      .collect();
    suitable_devices_ranked.sort_by(|&(_, l_rank), &(_, r_rank)| l_rank.cmp(&r_rank));
    info!(
      "Physical Devices most to least desirable:\n\t{:?}",
      suitable_devices_ranked
    );
    let physical_device = suitable_devices_ranked
      .first()
      .map(|&(device, _)| device)
      .ok_or(SarektError::CouldNotSelectPhysicalDevice(
        "No compatible device",
      ))?;
    if !Self::aaconfig_compatible(instance, physical_device, msaa_conifg)? {
      return Err(SarektError::CouldNotSelectPhysicalDevice(
        "AA mode not compatible",
      ));
    }
    Ok(physical_device)
  }
fn pick_physical_device ( instance : & Instance , surface_and_extension : & SurfaceAndExtension , msaa_conifg : & MsaaConfig , ) -> SarektResult < vk :: PhysicalDevice > { let available_physical_devices = unsafe { instance . enumerate_physical_devices ( ) . expect ( " " ) } ; // Assign some rank to all devices and get the highest one. let mut suitable_devices_ranked : Vec < _ > = available_physical_devices . into_iter ( ) . map ( | device | Self :: rank_device ( instance , device , surface_and_extension ) ) . filter ( | & ( _ , rank ) | rank > - 1i32 ) . collect ( ) ; suitable_devices_ranked . sort_by ( | & ( _ , l_rank ) , & ( _ , r_rank ) | l_rank . cmp ( & r_rank ) ) ; info ! ( " \n \t " suitable_devices_ranked ) ; let physical_device = suitable_devices_ranked . first ( ) . map ( | & ( device , _ ) | device ) . ok_or ( SarektError :: CouldNotSelectPhysicalDevice ( " " , ) ) ? ; if ! Self :: aaconfig_compatible ( instance , physical_device , msaa_conifg ) ? { return Err ( SarektError :: CouldNotSelectPhysicalDevice ( " " , ) ) ; } Ok ( physical_device ) }
Physical Device Helper Methods
Evaluates all the available physical devices in the system and picks the
best one based on a heuristic.
Physical Device Helper Methods Evaluates all the available physical devices in the system and picks the best one based on a heuristic .
instance
&Instance
surface_and_extension
&SurfaceAndExtension
msaa_conifg
&MsaaConfig
instance
&Instance
surface_and_extension
&SurfaceAndExtension
msaa_conifg
&MsaaConfig