mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-14 19:27:05 -04:00
GPU: note why Posterize's division correction is an fma (#405 follow-up)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
9b852b62af
commit
ea785355cd
1 file changed
+2
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user