SCurveTonemap: clamp out-of-gamut values after YPbPr->RGB conversion


The YPbPr->RGB round-trip can produce negative RGB components when
luma is compressed heavily by the S-curve while chroma stays fixed
(e.g. contrastBoost: 2 with a bright saturated input). Negative
values then reach pow() inside gammaCorrect, where GLSL defines
pow(x, y) as undefined for x < 0. Different GPU drivers return
different values — NVIDIA returns 0 (blue result) while AMD returns
a non-zero value (purple result), causing the effects/tonemaps
baseline test to render differently on Linux vs all other platforms.

Fix by clamping at the point where out-of-gamut values are created,
before adjSaturation, so that high saturationLevel values cannot
amplify negative components further before they reach pow().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pick-to: 6.12 6.11 6.8
Change-Id: Iabbba62446b4e08d0602c37da6c0be0de4a305b9
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
commit4869d9566ad95203e52d9355e63147e7b93d77de
parent06f1f524cc1a4bab335f03ae8aca7104c1a719d7
authorJonas Karlsson <jonas.karlsson@qt.io>
committerJonas Karlsson <jonas.karlsson@qt.io>
commit timeTue, 30 Jun 2026 11:56:07 +0000