Skip to content

Releases: gpujs/gpu.js

2.19.2

Choose a tag to compare

@fuzzie360 fuzzie360 released this 22 Jul 13:34

Security maintenance release.

Changed

  • Dependabot alerts: 51 → 4. All critical (5) and high (28) severity alerts resolved via npm audit fix across the dev tooling, browser-sync 3.0.4, and dependency overrides: node-gyp ^11 under gl (brings patched tar/cacache/make-fetch-happen to the source-build path) and immutable ^4.3.9. Source builds through the overridden node-gyp verified on Linux arm64.
  • The 4 remaining low-severity alerts are in the elliptic chain under browserify's Node-crypto polyfill: no patched elliptic release 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

Choose a tag to compare

@fuzzie360 fuzzie360 released this 22 Jul 13:27

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 to Uint8ClampedArray (#837, thanks @stity)

Changed

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

Choose a tag to compare

@fuzzie360 fuzzie360 released this 22 Jul 13:22

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 (22.015625) and everything else lost its low mantissa bits (32.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 / -2042500 returned 0: the divisibility check assumed positive operands. Now sign-correct by construction (round the quotient, verify by exact multiplication) — this also removes the out-of-range int() casts that PR #723 flagged.
  • getPixels tests/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

Choose a tag to compare

@fuzzie360 fuzzie360 released this 22 Jul 13:03

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-argument atan(y / x), which collapses the result into (-π/2, π/2) and is undefined at x = 0; it now uses two-argument atan(y, x) with explicit x = 0 handling, matching JavaScript's Math.atan2 across 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

Choose a tag to compare

@fuzzie360 fuzzie360 released this 22 Jul 12:38

Bug-fix release: browser bundle in strict-mode / ES-module loads.

Fixed

  • TypeError: Cannot set property GPU of #<Window> which has only a getter when the browser bundle is evaluated in a strict-mode context, e.g. loaded as an ES module (#639). The global GPU binding 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

Choose a tag to compare

@fuzzie360 fuzzie360 released this 22 Jul 12:33

Bug-fix release: memory leak with dynamic output kernels.

Fixed

  • Memory leak when calling setOutput() on a dynamicOutput kernel (#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

Choose a tag to compare

@fuzzie360 fuzzie360 released this 22 Jul 12:24

Feature release: reproducible Math.random() via custom seeds.

Added

  • Custom seed for Math.random() (#850). Seed a kernel with kernel.setRandomSeed(seed) or the randomSeed kernel 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 setRandomSeed again — 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); cpu mode 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

Choose a tag to compare

@fuzzie360 fuzzie360 released this 22 Jul 11:59

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 define window.GPU as the native WebGPU interface; the browser bundle saw the name as taken and ended up leaving a plain namespace object on window.GPU instead of the constructor. The bundle now claims the global name correctly:
    • new GPU() works in Chrome, Edge, Firefox, and Web Workers
    • new GPU.GPU() — the widespread workaround — continues to work
    • GPU.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>

2.17.0

Choose a tag to compare

@fuzzie360 fuzzie360 released this 22 Jul 11:47

Maintenance release focused on making gpu.js installable again on modern toolchains.

Installing

npm install gpu.js@2.17.0
<script src="https://unpkg.com/gpu.js@2.17.0/dist/gpu-browser.min.js"></script>

Maintenance release

Choose a tag to compare

@robertleeplummerjr robertleeplummerjr released this 19 Jan 17:01

Fixes from: