fn _find_queue_fam_indices(
        device: vk::PhysicalDevice,
        queue_fam_props: &Vec<vk::QueueFamilyProperties>,
        surface_entry: &khr::Surface,
        surface: vk::SurfaceKHR,
    ) -> VkResult<Option<QueueFamilyIndices>> {
        let mut graphics_ndx: Option<u32> = None;
        let mut present_ndx: Option<u32> = None;

        for (i, q) in queue_fam_props.iter().enumerate() {
            if q.queue_flags.contains(vk::QueueFlags::GRAPHICS) {
                graphics_ndx = Some(i as u32);
            }

            let supports_presentation = unsafe {
                surface_entry.get_physical_device_surface_support(device, i as u32, surface)?
            };

            if supports_presentation {
                present_ndx = Some(i as u32);
            }

            if let (Some(g), Some(p)) = (graphics_ndx, present_ndx) {
                return Ok(Some(QueueFamilyIndices {
                    graphics: g,
                    presentation: p,
                }));
            }
        }

        Ok(None)
    }
// search for queue families supporting graphics and presentation
// and return their indices (or None, if none are found)
search for queue families supporting graphics and presentation
and return their indices (or None, if none are found)
search for queue families supporting graphics and presentation and return their indices ( or None if none are found )
fn _find_queue_fam_indices(
        device: vk::PhysicalDevice,
        queue_fam_props: &Vec<vk::QueueFamilyProperties>,
        surface_entry: &khr::Surface,
        surface: vk::SurfaceKHR,
    ) -> VkResult<Option<QueueFamilyIndices>> {
        let mut graphics_ndx: Option<u32> = None;
        let mut present_ndx: Option<u32> = None;
        for (i, q) in queue_fam_props.iter().enumerate() {
            if q.queue_flags.contains(vk::QueueFlags::GRAPHICS) {
                graphics_ndx = Some(i as u32);
            }
            let supports_presentation = unsafe {
                surface_entry.get_physical_device_surface_support(device, i as u32, surface)?
            };
            if supports_presentation {
                present_ndx = Some(i as u32);
            }
            if let (Some(g), Some(p)) = (graphics_ndx, present_ndx) {
                return Ok(Some(QueueFamilyIndices {
                    graphics: g,
                    presentation: p,
                }));
            }
        }
        Ok(None)
    }
fn _find_queue_fam_indices ( device : vk :: PhysicalDevice , queue_fam_props : & Vec < vk :: QueueFamilyProperties > , surface_entry : & khr :: Surface , surface : vk :: SurfaceKHR , ) -> VkResult < Option < QueueFamilyIndices > > { let mut graphics_ndx : Option < u32 > = None ; let mut present_ndx : Option < u32 > = None ; for ( i , q ) in queue_fam_props . iter ( ) . enumerate ( ) { if q . queue_flags . contains ( vk :: QueueFlags :: GRAPHICS ) { graphics_ndx = Some ( i as u32 ) ; } let supports_presentation = unsafe { surface_entry . get_physical_device_surface_support ( device , i as u32 , surface ) ? } ; if supports_presentation { present_ndx = Some ( i as u32 ) ; } if let ( Some ( g ) , Some ( p ) ) = ( graphics_ndx , present_ndx ) { return Ok ( Some ( QueueFamilyIndices { graphics : g , presentation : p , } ) ) ; } } Ok ( None ) }
search for queue families supporting graphics and presentation
and return their indices (or None, if none are found)
search for queue families supporting graphics and presentation and return their indices ( or None if none are found )
device
vk::PhysicalDevice
queue_fam_props
&Vec<vk::QueueFamilyProperties>
surface_entry
&khr::Surface
surface
vk::SurfaceKHR
device
vk::PhysicalDevice
queue_fam_props
&Vec<vk::QueueFamilyProperties>
surface_entry
&khr::Surface
surface
vk::SurfaceKHR