Expand description
HDR and wide-gamut surface format selection for the wgpu backend.
This module provides:
SurfaceColorFormat— an enumeration of supported colour formats with their metadata (bits per channel, colour gamut, HDR capability).HdrGpuContext— a headless GPU context that usesRgba16Float(wide-gamut / HDR) instead of the defaultRgba8Unorm.select_surface_format— a heuristic that picks the best available format from a list of adapter-supported formats, preferring HDR variants when available and the caller opts in.
§Colour-space handling in the fragment shader
Rgba8Unorm stores gamma-encoded sRGB values; Rgba16Float stores linear
light values in the Rec.2020 or Display-P3 colour space (depending on the
OS colour management layer). When rendering into an Rgba16Float target
the fragment shader should output linear light values; the display pipeline
applies the appropriate OETF (transfer function) on presentation.
For headless / offscreen rendering (HdrGpuContext) the application
reads back raw f16 values; it is the caller’s responsibility to apply any
tone-mapping required before displaying or saving the image.
Structs§
- HdrGpu
Context - A headless GPU context backed by an
Rgba16Floatoffscreen texture.
Enums§
- Surface
Color Format - A supported colour surface format.
Constants§
- HDR_
FORMAT - The HDR offscreen format.
Functions§
- select_
surface_ format - Choose the best format from
supported_formatsgiven a preference.