xgpui-gamut
Wide-gamut color extension for xgpui. Draw explicit linear Display P3 SDR content alongside ordinary sRGB controls, without changing the color meaning of existing UI paints.
Dependencies
[]
= { = "xgpui", = "4.0.0" }
= "0.4.0"
Enable wide content
Request wide-gamut SDR on the window outside drawing, then use a WideColor
producer. xgpui-shader supplies optional painted() container ergonomics:
use ;
use Arc;
use WideColor;
use painted;
window.set_color_mode?;
let red = new;
painted
.w.h
.bg_paint
.child
Add xgpui-shader = "0.5.0" for that container example. The default producer can
also be used without the shader extension. Inspect the window's reported color
status; requesting wide output is not proof that the display is presenting it.
Instanced fills and gradients
Enable instanced for instanced::WidePainter and WideGradient. This feature
adds a dependency on xgpui-shader and draws supported solids/gradients directly
in the host render pass. The default WideColor producer retains its texture
preparation path.
CPU conversions, gamut mapping and gradient sampling come from xgpui-color.
GPU adapters have their own finite-value and geometry limits; CPU color values
are not automatically valid upload parameters.
Platform limits
The native integration targets macOS Metal and Windows D3D11. Windows native execution and physical-display validation remain separate from cross-compilation. Linux wide presentation, HDR content and transparent wide windows are deferred. This API does not reinterpret existing shaders or sRGB paints as Display P3.
Guides and examples
- Window color requests, status and backend contract
- Instanced wide fills and gradients
- Gamut lab and validation
From the repository root, run just gamut for the native comparison app.
GPUI public API changes: additions and compatibility
Use this crate with xgpui's matching framework packages. Its integration depends on xgpui's GPUI API changes. See the compatibility guide for additions, affected public types and migration requirements.
Project
Repository · Release preparation · Website. Licensed under Apache-2.0.
This extension uses its own 0.2.0 version, separate from xgpui framework
1.0.0 and the upstream GPUI baseline.