Releases: gpujs/gpu.js
Release list
2.19.2
Security maintenance release.
Changed
- Dependabot alerts: 51 → 4. All critical (5) and high (28) severity alerts resolved via
npm audit fixacross the dev tooling, browser-sync 3.0.4, and dependency overrides:node-gyp^11 undergl(brings patchedtar/cacache/make-fetch-happento the source-build path) andimmutable^4.3.9. Source builds through the overridden node-gyp verified on Linux arm64. - The 4 remaining low-severity alerts are in the
ellipticchain under browserify's Node-crypto polyfill: no patchedellipticrelease exists yet, and gpu.js never bundles the crypto polyfill, so the vulnerable code is unreachable in this project. - No source changes; kernels behave identically to 2.19.1.
Installing
npm install gpu.js@2.19.2<script src="https://unpkg.com/gpu.js@2.19.2/dist/gpu-browser.min.js"></script>2.19.1
Community PR harvest — seven long-open pull requests merged, some waiting since 2021. Thank you all.
Fixed
- Helper functions receiving arguments in a different order than the kernel no longer get wrong argument bit ratios (#846, thanks @ChenZhuoSteve; earlier partial fix in #731 by @exebetche)
addFunction()with a function-string source no longer throws (#729, thanks @m0ose)- WebGL feature detection no longer crashes in Web Workers / OffscreenCanvas environments (#779, thanks @jbghoul — fixes #778)
- Minified browser bundles are now pure ASCII, fixing Safari regex errors from re-encoded sources (#744, thanks @jbghoul — fixes #743)
getPixels()TypeScript return type corrected toUint8ClampedArray(#837, thanks @stity)
Changed
- Compile-time speedup: constant lookup arrays hoisted out of per-AST-node methods (#713, thanks @wwwzbwcom)
- Deprecated
substr()replaced withslice()(#747, thanks @CommanderRoot) - New demo: animated parallel raytracer (#833, thanks @jin)
Note: #824 (cropped rendering) was merged and then reverted in this same release — its viewport clamp breaks framebuffer-texture rendering; details on the PR.
Installing
npm install gpu.js@2.19.1<script src="https://unpkg.com/gpu.js@2.19.1/dist/gpu-browser.min.js"></script>2.19.0
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>2.18.3
Bug-fix release: correct Math.atan2 results on the GPU.
Fixed
Math.atan2(y, x)returned wrong quadrants on GPU backends (#647). The GLSL implementation used single-argumentatan(y / x), which collapses the result into (-π/2, π/2) and is undefined at x = 0; it now uses two-argumentatan(y, x)with explicit x = 0 handling, matching JavaScript'sMath.atan2across the full (-π, π] range. Thanks @ted-piotrowski for the fix (#683, merged at last).
Installing
npm install gpu.js@2.18.3<script src="https://unpkg.com/gpu.js@2.18.3/dist/gpu-browser.min.js"></script>2.18.2
Bug-fix release: browser bundle in strict-mode / ES-module loads.
Fixed
TypeError: Cannot set property GPU of #<Window> which has only a getterwhen the browser bundle is evaluated in a strict-mode context, e.g. loaded as an ES module (#639). The globalGPUbinding now accepts (and ignores) writes instead of throwing. Regression-tested alongside the WebGPU-collision scenarios from #844/#820.
Installing
npm install gpu.js@2.18.2<script src="https://unpkg.com/gpu.js@2.18.2/dist/gpu-browser.min.js"></script>2.18.1
Bug-fix release: memory leak with dynamic output kernels.
Fixed
- Memory leak when calling
setOutput()on adynamicOutputkernel (#841). Every replaced output texture's handle was retained in an internal cache until the kernel was destroyed, so long-running kernels that resize between runs grew process memory without bound (even when the size didn't actually change). Texture deletion now evicts the handle from the cache. Verified with 20k resize+run iterations: RSS stays flat (~108 MB) instead of climbing without bound.
Installing
npm install gpu.js@2.18.1<script src="https://unpkg.com/gpu.js@2.18.1/dist/gpu-browser.min.js"></script>2.18.0
Feature release: reproducible Math.random() via custom seeds.
Added
-
Custom seed for
Math.random()(#850). Seed a kernel withkernel.setRandomSeed(seed)or therandomSeedkernel setting:const kernel = gpu.createKernel(function() { return Math.random(); }, { output: [64], randomSeed: 42 });
A seeded kernel draws its per-run GPU seed uniforms from a deterministic stream (mulberry32): consecutive runs differ, but recreating the kernel — or calling
setRandomSeedagain — with the same seed replays the exact same sequence of runs. Unseeded kernels behave exactly as before.Applies to GPU modes (
gpu,webgl,webgl2,headlessgl);cpumode logs a warning and stays unseeded. TypeScript definitions included.
Installing
npm install gpu.js@2.18.0<script src="https://unpkg.com/gpu.js@2.18.0/dist/gpu-browser.min.js"></script>2.17.1
Bug-fix release: new GPU() works again in Chrome and Edge.
Fixed
new GPU()no longer throws "GPU is not a constructor" in WebGPU-capable browsers (#844, #820). Chrome 113+ and Edge definewindow.GPUas the native WebGPU interface; the browser bundle saw the name as taken and ended up leaving a plain namespace object onwindow.GPUinstead of the constructor. The bundle now claims the global name correctly:new GPU()works in Chrome, Edge, Firefox, and Web Workersnew GPU.GPU()— the widespread workaround — continues to workGPU.Texture,GPU.Input,GPU.input,GPU.utils, etc. remain attached- a page that loads gpu.js twice keeps the first copy, as before
Installing
npm install gpu.js@2.17.1<script src="https://unpkg.com/gpu.js@2.17.1/dist/gpu-browser.min.js"></script>