fn find_queue_families(
    instance: &Instance, physical_device: vk::PhysicalDevice,
    surface_and_extension: &SurfaceAndExtension,
  ) -> SarektResult<QueueFamilyIndices> {
    let surface_functions = &surface_and_extension.surface_functions;
    let surface = surface_and_extension.surface;

    let mut queue_family_indices = QueueFamilyIndices::default();
    let queue_family_properties =
      unsafe { instance.get_physical_device_queue_family_properties(physical_device) };

    for (i, queue_family_properties) in queue_family_properties.iter().enumerate() {
      if queue_family_indices.transfer_queue_family.is_none()
        && queue_family_properties
          .queue_flags
          .intersects(vk::QueueFlags::TRANSFER)
        && !queue_family_properties
          .queue_flags
          .intersects(vk::QueueFlags::GRAPHICS | vk::QueueFlags::COMPUTE)
      {
        // Is transfer but NOT graphics or compute.  This queue is optimal for
        // transfer.
        queue_family_indices.transfer_queue_family = Some(i as u32);
      }

      if queue_family_indices.graphics_queue_family.is_none()
        && queue_family_properties
          .queue_flags
          .intersects(vk::QueueFlags::GRAPHICS)
      {
        queue_family_indices.graphics_queue_family = Some(i as u32);
      }

      if queue_family_indices.presentation_queue_family.is_none() {
        let presentation_support = unsafe {
          surface_functions.get_physical_device_surface_support(
            physical_device,
            i as u32,
            surface,
          )?
        };
        if presentation_support {
          queue_family_indices.presentation_queue_family = Some(i as u32);
        }
      }

      if queue_family_indices.is_complete() {
        return Ok(queue_family_indices);
      }
    }

    // Iterated through all queue types, but explicit transfer queue family not
    // found, just set it to the same as graphics queue family.
    queue_family_indices.transfer_queue_family = queue_family_indices.graphics_queue_family;

    Ok(queue_family_indices)
  }
/// Finds the queue family indices to use for the rendering command
/// submissions.  Right now only picks the first suitable queue family for
/// each type of command.
Finds the queue family indices to use for the rendering command
submissions.  Right now only picks the first suitable queue family for
each type of command.
Finds the queue family indices to use for the rendering command submissions . Right now only picks the first suitable queue family for each type of command .
fn find_queue_families(
    instance: &Instance, physical_device: vk::PhysicalDevice,
    surface_and_extension: &SurfaceAndExtension,
  ) -> SarektResult<QueueFamilyIndices> {
    let surface_functions = &surface_and_extension.surface_functions;
    let surface = surface_and_extension.surface;
    let mut queue_family_indices = QueueFamilyIndices::default();
    let queue_family_properties =
      unsafe { instance.get_physical_device_queue_family_properties(physical_device) };
    for (i, queue_family_properties) in queue_family_properties.iter().enumerate() {
      if queue_family_indices.transfer_queue_family.is_none()
        && queue_family_properties
          .queue_flags
          .intersects(vk::QueueFlags::TRANSFER)
        && !queue_family_properties
          .queue_flags
          .intersects(vk::QueueFlags::GRAPHICS | vk::QueueFlags::COMPUTE)
      {
        // Is transfer but NOT graphics or compute.  This queue is optimal for
        // transfer.
        queue_family_indices.transfer_queue_family = Some(i as u32);
      }
      if queue_family_indices.graphics_queue_family.is_none()
        && queue_family_properties
          .queue_flags
          .intersects(vk::QueueFlags::GRAPHICS)
      {
        queue_family_indices.graphics_queue_family = Some(i as u32);
      }
      if queue_family_indices.presentation_queue_family.is_none() {
        let presentation_support = unsafe {
          surface_functions.get_physical_device_surface_support(
            physical_device,
            i as u32,
            surface,
          )?
        };
        if presentation_support {
          queue_family_indices.presentation_queue_family = Some(i as u32);
        }
      }
      if queue_family_indices.is_complete() {
        return Ok(queue_family_indices);
      }
    }
    // Iterated through all queue types, but explicit transfer queue family not
    // found, just set it to the same as graphics queue family.
    queue_family_indices.transfer_queue_family = queue_family_indices.graphics_queue_family;
    Ok(queue_family_indices)
  }
fn find_queue_families ( instance : & Instance , physical_device : vk :: PhysicalDevice , surface_and_extension : & SurfaceAndExtension , ) -> SarektResult < QueueFamilyIndices > { let surface_functions = & surface_and_extension . surface_functions ; let surface = surface_and_extension . surface ; let mut queue_family_indices = QueueFamilyIndices :: default ( ) ; let queue_family_properties = unsafe { instance . get_physical_device_queue_family_properties ( physical_device ) } ; for ( i , queue_family_properties ) in queue_family_properties . iter ( ) . enumerate ( ) { if queue_family_indices . transfer_queue_family . is_none ( ) && queue_family_properties . queue_flags . intersects ( vk :: QueueFlags :: TRANSFER ) && ! queue_family_properties . queue_flags . intersects ( vk :: QueueFlags :: GRAPHICS | vk :: QueueFlags :: COMPUTE ) { // Is transfer but NOT graphics or compute.  This queue is optimal for // transfer. queue_family_indices . transfer_queue_family = Some ( i as u32 ) ; } if queue_family_indices . graphics_queue_family . is_none ( ) && queue_family_properties . queue_flags . intersects ( vk :: QueueFlags :: GRAPHICS ) { queue_family_indices . graphics_queue_family = Some ( i as u32 ) ; } if queue_family_indices . presentation_queue_family . is_none ( ) { let presentation_support = unsafe { surface_functions . get_physical_device_surface_support ( physical_device , i as u32 , surface , ) ? } ; if presentation_support { queue_family_indices . presentation_queue_family = Some ( i as u32 ) ; } } if queue_family_indices . is_complete ( ) { return Ok ( queue_family_indices ) ; } } // Iterated through all queue types, but explicit transfer queue family not // found, just set it to the same as graphics queue family. queue_family_indices . transfer_queue_family = queue_family_indices . graphics_queue_family ; Ok ( queue_family_indices ) }
Finds the queue family indices to use for the rendering command
submissions.
Finds the queue family indices to use for the rendering command submissions .
instance
&Instance
physical_device
vk::PhysicalDevice
surface_and_extension
&SurfaceAndExtension
instance
&Instance
physical_device
vk::PhysicalDevice
surface_and_extension
&SurfaceAndExtension