GPU: note why Posterize's division correction is an fma (#405 follow-up)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas 2026-10-09 10:22:01 -04:00
parent 9b852b62af
commit ea785355cd
1 changed files with 2 additions and 0 deletions

View File

@ -40,6 +40,8 @@ fn fxs_smoothstep(e0: f32, e1: f32, x: f32) -> f32 {
fn fxs_qdiv(x: vec3<f32>, a: f32) -> vec3<f32> {
let q = x / a;
let r = fma(-q, vec3<f32>(a), x);
// `q + r / a`, written as an fma so drivers (NVIDIA Vulkan) can't contract it another way
// and round differently from the CPU.
return fma(r / a, vec3<f32>(1.0), q);
}