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:
parent
9b852b62af
commit
ea785355cd
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue