Major correctness release for GPU float handling — especially on Apple silicon.
Fixed
- Unsigned-precision kernels return correct values on Apple silicon (#659). The float→RGBA8 encoder/decoder relied on
log2/pow/exp2, which are 1–2 ulp approximate on some GPUs (notably ANGLE/Metal). Powers of two came back visibly wrong (2→2.015625) and everything else lost its low mantissa bits (3→2.9999995), affecting kernel outputs, argument reads, and bitwise ops. The codec now uses exact arithmetic: a 198-value round-trip harness goes from 192 failures to 0, and the full test suite on Apple silicon drops from 157 failures to 12. Mesa/Linux results verified unchanged (x64 and arm64). - Negative integer division with
fixIntegerDivisionAccuracy(#742).-1045000 / -2042500returned0: the divisibility check assumed positive operands. Now sign-correct by construction (round the quotient, verify by exact multiplication) — this also removes the out-of-rangeint()casts that PR #723 flagged. getPixelstests/values at exact UNORM8 rounding boundaries were driver-dependent; test inputs moved off the boundaries and now pass on every backend including cpu.
Installing
npm install gpu.js@2.19.0<script src="https://unpkg.com/gpu.js@2.19.0/dist/gpu-browser.min.js"></script>