From 836c68bb20ba84c33b96c74523c1a2dfd9469bf5 Mon Sep 17 00:00:00 2001 From: Minh Vu Date: Thu, 17 Sep 2026 16:09:12 +0000 Subject: [PATCH] gpui_windows: Fix reversed linear/sRGB transfer functions in shader (#57543) ## Summary - swap the Windows HLSL exponents for `linear_to_srgb` and `srgb_to_linear` - align the Windows Oklab gradient path with the existing Metal and WGSL implementations ## Testing - not run (shader-only change) Fixes #57542 Release Notes: - [GPUI] Fix reversed linear/sRGB transfer functions Co-authored-by: Chris Biscardi --- crates/gpui_windows/src/shaders.hlsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/gpui_windows/src/shaders.hlsl b/crates/gpui_windows/src/shaders.hlsl index d20cb317db..ba89c68733 100644 --- a/crates/gpui_windows/src/shaders.hlsl +++ b/crates/gpui_windows/src/shaders.hlsl @@ -127,12 +127,12 @@ float4 distance_from_clip_rect_transformed(float2 unit_vertex, Bounds bounds, Bo // Convert linear RGB to sRGB float3 linear_to_srgb(float3 color) { - return pow(color, float3(2.2, 2.2, 2.2)); + return pow(color, float3(1.0 / 2.2, 1.0 / 2.2, 1.0 / 2.2)); } // Convert sRGB to linear RGB float3 srgb_to_linear(float3 color) { - return pow(color, float3(1.0 / 2.2, 1.0 / 2.2, 1.0 / 2.2)); + return pow(color, float3(2.2, 2.2, 2.2)); } /// Hsla to linear RGBA conversion.