mirror of
https://github.com/storytold/lightcraft.git
synced 2026-11-01 05:57:09 -06:00
The GPU colour tools took the hue of every pixel with atan2(a, b). For a black pixel both are 0, and WGSL leaves atan2(0, 0) undefined: on an RTX 3090 (Vulkan) it is NaN, so with any colour tool on (saturation, vibrance, the mixer) every exactly black pixel became NaN. NaN is written as 0, so it stayed black and nothing showed, until a later step lightened it: with a positive vignette the CPU lifts the black corners and the GPU left them black (up to 127 levels apart in 8-bit). A neutral pixel now gets hue 0, as Rust's atan2 gives on the CPU. Regression test: black bars under a light vignette with saturation, vibrance or the mixer (fails on main: mean 12.8, max 127 levels). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014ti8KemZbjE2ZgHgV1q1BM