From 30a2cc7c61001a5c284185b3c25bb106cff0336b Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Thu, 22 Oct 2026 08:26:52 +0200 Subject: [PATCH] Wayland: pin the 8-bit surface choice with a colour-managed compositor's list (#1007) #1007's white overlay on Hyprland is #1075's washed-out swapchain: a Wayland compositor with colour management makes Mesa list Rgba16Float first, and the first non-sRGB format was taken. Reproduced on a real GPU (Mesa 26.2 ANV, Intel HD 620) under headless weston 16: the old choice washes the frame out, main's Bgra8Unorm doesn't. This test keeps that list, as wgpu reports it, choosing an 8-bit format. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/gfx.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/crates/horizon-client/src/gfx.rs b/crates/horizon-client/src/gfx.rs index 127aaf737..4171cf8ea 100644 --- a/crates/horizon-client/src/gfx.rs +++ b/crates/horizon-client/src/gfx.rs @@ -4155,6 +4155,34 @@ mod tests { ); assert_eq!(surface_format(&[Rgba16Float], Bgra8UnormSrgb), Rgba16Float); } + /// A Wayland surface on a compositor with colour management, as wgpu lists it (Mesa 26.2 + /// ANV on an Intel HD 620 under weston 16): wide formats first. The pre-#1075 choice, + /// the first non-sRGB format, took `Rgba16Float` and the window looked washed out, as if + /// under a white overlay (#1007); XWayland lists no such format, which is why it looked fine. + #[test] + fn a_colour_managed_wayland_surface_still_gets_8_bit() { + use super::surface_format; + use wgpu::TextureFormat::*; + let wayland = [ + Rgba16Float, + Rgba16Unorm, + Rgb10a2Unorm, + Bgra8UnormSrgb, + Bgra8Unorm, + Rgba8UnormSrgb, + Rgba8Unorm, + ]; + assert_eq!(surface_format(&wayland, Bgra8UnormSrgb), Bgra8Unorm); + // Without Bgra8: Rgba8, still not a 16- or 10-bit format. + let without_bgra = [ + Rgba16Float, + Rgba16Unorm, + Rgb10a2Unorm, + Rgba8UnormSrgb, + Rgba8Unorm, + ]; + assert_eq!(surface_format(&without_bgra, Rgba8UnormSrgb), Rgba8Unorm); + } #[test] fn special_material_batches_preserve_quad_order_and_offsets() { let quad = |layer, id| {