From adb4fcb57a436d098683c79855036b795dbc46fa Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Thu, 16 Jul 2026 20:25:20 +1000 Subject: [PATCH] [client] fix the HDR colorspace mapping to SDR --- client/renderers/EGL/shader/hdr.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/renderers/EGL/shader/hdr.h b/client/renderers/EGL/shader/hdr.h index 1efc5dd7..da250e15 100644 --- a/client/renderers/EGL/shader/hdr.h +++ b/client/renderers/EGL/shader/hdr.h @@ -102,7 +102,12 @@ vec3 bt2020to709(vec3 bt2020) vec3 mapToSDR(vec3 color, float gain, bool pq) { if (pq) + { + // HDR10: PQ-encoded BT.2020. Linearise then convert the gamut to BT.709. color = pq2lin(color.rgb, gain); - color = bt2020to709(color); + color = bt2020to709(color); + } + // else: scRGB is already linear BT.709 (1.0 == SDR white), so no EOTF or + // gamut conversion is required - only highlight compression below. return lin2srgb(compress(color)); }