Expand description
Headless wgpu device acquisition and the offscreen colour target.
GpuContext::headless performs the full no-window initialisation chain:
Instance → request_adapter → request_device/queue → an offscreen
colour texture. Every step that can fail returns a UiError; in
particular, a missing adapter (no GPU available) yields
UiError::Unsupported so callers — most importantly the headless tests —
can gracefully skip rather than panic on machines without a usable GPU.
The offscreen target uses wgpu::TextureFormat::Rgba8Unorm (the linear,
non-sRGB variant) so that a solid colour written by the fragment shader is
copied back byte-for-byte. An sRGB target would apply the OETF on store and
distort the asserted pixel values.
Structs§
- GpuContext
- An initialised headless GPU context: device, queue, and an offscreen colour texture (plus its view) sized to the requested surface.
Constants§
- TARGET_
FORMAT - The non-sRGB offscreen colour format. Chosen so solid-colour readback is byte-exact (sRGB encoding would skew the stored values).