fn find_queue_families(physical_device: &PhysicalDevice, surface: &SurfaceKhr)
        -> VdResult<QueueFamilyIndices> {
    let queue_families = physical_device.queue_family_properties()?;
    let mut graphics_family_idx = None;
    let mut present_family_idx = None;

    let mut i = 0u32;
    for queue_family in &queue_families {
        if queue_family.queue_count() > 0 && queue_family.queue_flags()
                .contains(QueueFlags::GRAPHICS) {
            graphics_family_idx = Some(i);
        }

        let presentation_support = physical_device.surface_support_khr(i as u32, surface)?;
        if queue_family.queue_count() > 0 && presentation_support {
            present_family_idx = Some(i);
        }

        if let (Some(gf_idx), Some(pf_idx)) = (graphics_family_idx, present_family_idx) {
            return Ok(QueueFamilyIndices::new(gf_idx, pf_idx));
        }

        i += 1;
    }
    Err("unable to find graphics and/or presentation queue family support".into())
}
/// Returns the queue family indices for the queue families supporting
/// graphics and presentation on `physical_device`.
Returns the queue family indices for the queue families supporting
graphics and presentation on `physical_device`.
Returns the queue family indices for the queue families supporting graphics and presentation on ` physical_device ` .
fn find_queue_families(physical_device: &PhysicalDevice, surface: &SurfaceKhr)
        -> VdResult<QueueFamilyIndices> {
    let queue_families = physical_device.queue_family_properties()?;
    let mut graphics_family_idx = None;
    let mut present_family_idx = None;
    let mut i = 0u32;
    for queue_family in &queue_families {
        if queue_family.queue_count() > 0 && queue_family.queue_flags()
                .contains(QueueFlags::GRAPHICS) {
            graphics_family_idx = Some(i);
        }
        let presentation_support = physical_device.surface_support_khr(i as u32, surface)?;
        if queue_family.queue_count() > 0 && presentation_support {
            present_family_idx = Some(i);
        }
        if let (Some(gf_idx), Some(pf_idx)) = (graphics_family_idx, present_family_idx) {
            return Ok(QueueFamilyIndices::new(gf_idx, pf_idx));
        }
        i += 1;
    }
    Err("unable to find graphics and/or presentation queue family support".into())
}
fn find_queue_families ( physical_device : & PhysicalDevice , surface : & SurfaceKhr ) -> VdResult < QueueFamilyIndices > { let queue_families = physical_device . queue_family_properties ( ) ? ; let mut graphics_family_idx = None ; let mut present_family_idx = None ; let mut i = 0u32 ; for queue_family in & queue_families { if queue_family . queue_count ( ) > 0 && queue_family . queue_flags ( ) . contains ( QueueFlags :: GRAPHICS ) { graphics_family_idx = Some ( i ) ; } let presentation_support = physical_device . surface_support_khr ( i as u32 , surface ) ? ; if queue_family . queue_count ( ) > 0 && presentation_support { present_family_idx = Some ( i ) ; } if let ( Some ( gf_idx ) , Some ( pf_idx ) ) = ( graphics_family_idx , present_family_idx ) { return Ok ( QueueFamilyIndices :: new ( gf_idx , pf_idx ) ) ; } i += 1 ; } Err ( " " . into ( ) ) }
Returns the queue family indices for the queue families supporting
graphics and presentation on `physical_device`.
Returns the queue family indices for the queue families supporting graphics and presentation on ` physical_device ` .
physical_device
&PhysicalDevice
surface
&SurfaceKhr
physical_device
&PhysicalDevice
surface
&SurfaceKhr