Skip to main content

custom_choice

Function custom_choice 

Source
pub fn custom_choice(
    adapters: &[GpuAdapterInfo],
    selector: &dyn Fn(&[GpuAdapterInfo]) -> Option<usize>,
) -> Result<usize>
Expand description

Resolve a GpuPreference::Custom selector against the adapters that were enumerated.

The selector chooses one adapter out of the whole list — it does not rank them. None, or an index outside the list, is an error rather than a fallback: the application and this code saw the same enumeration, so a disagreement is a bug worth naming instead of silently drawing on a GPU the application did not choose.