Skip to main content

select_surface_format

Function select_surface_format 

Source
pub fn select_surface_format(
    supported_formats: &[TextureFormat],
    prefer_hdr: bool,
) -> SurfaceColorFormat
Expand description

Choose the best format from supported_formats given a preference.

When prefer_hdr is true, Rgba16Float is preferred if available. Otherwise, sRGB variants are preferred over linear unorm (for correct gamma on standard SDR displays). Falls back to the first format in the list, or SurfaceColorFormat::Rgba8Unorm if the list is empty.