visionOS: Use an 8-bit sRGB layer format with a non-sRGB view


The compositor layer was configured with MTLPixelFormatRGBA16Float. The
compositor treats a float layer as linear light, but Qt Quick and Qt
Quick 3D produce display-referred, sRGB-encoded output, exactly as they
do for a window swapchain: the tonemapper is the last step of the 3D
pass and the 2D scenegraph writes its colors as they are. The result was
gamma-encoded twice on display, so everything came out too bright. The
green (#008000) text in the xr_simple example measured (0, 188, 0) in
the simulator, and any value above 1.0 written by a material was passed
on unclamped.

Pick the color format from the layer capabilities instead, preferring
BGRA8Unorm_sRGB and then RGBA8Unorm_sRGB, and render into the texture
through a non-sRGB view so that the GPU does not encode the output a
second time on write. RGBA16Float remains as a fallback, with a warning,
should no 8-bit sRGB format be offered.

Pick-to: 6.12
Change-Id: Idcc5753b58de3aef342de5ade425f9821090167a
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
commitbb1485a95dc91d8e05ee9b0b2ee82dc635ef24ed
parentf8222680f9f2b3688c938ec9ec11f08b0be41f7d
authorChristian Strømme <christian.stromme@qt.io>
committerChristian Strømme <christian.stromme@qt.io>
commit timeWed, 21 Oct 2026 15:08:46 +0000