pub fn choose_surface_format(
caps: &SurfaceCapabilities,
) -> Option<TextureFormat>Expand description
Chooses the first sRGB format, falling back to the first advertised format.
Returns None only when caps.formats is empty. Input ordering is retained
within each preference class.
ยงExamples
use ailloli_ui_render_wgpu::pipeline_cache::choose_surface_format;
let mut caps = wgpu::SurfaceCapabilities::default();
caps.formats = vec![
wgpu::TextureFormat::Bgra8Unorm,
wgpu::TextureFormat::Bgra8UnormSrgb,
];
assert_eq!(choose_surface_format(&caps), Some(wgpu::TextureFormat::Bgra8UnormSrgb));