Skip to content
CAI
Software that uses CAICheck a score

gpujs/gpu.js

47.8

Weak · 15 November 2026

33.7k

lines of production code

JavaScript

primary language

5

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

Features

Add WebGL 2 kernel value implementations

This change introduces the WebGL 2-specific implementations for all kernel value types (such as arrays, textures, images, and inputs) in the \src/backend/web-gl2/kernel-value\ directory. Each file defines a class that extends the corresponding base WebGL kernel value, providing the necessary GLSL source generation and value update logic required for the WebGL 2 backend to handle kernel arguments and constants.

src/backend/web-gl2/kernel-value · high confidence

Add cat-image and raster-globe browser examples

Two new interactive browser examples are now available in the examples directory. The cat-image example demonstrates converting an image to a GPU.js kernel for real-time wobble animation, while the raster-globe example showcases a rotating 3D globe using azimuthal equal-area and orthographic projections with custom rotation functions.

examples/cat-image · high confidence

Initial WebGL 2 backend implementation

This change introduces the core files for a new WebGL 2 rendering backend, including the kernel entry point, fragment and vertex shaders, and the function node and kernel value mapping logic. The fragment shader provides GLSL implementations for JavaScript Math functions (such as atan2, cbrt, and bitwise operations) and supports both single-precision and unsigned integer types. The kernel value maps define how various input types (like arrays, textures, and HTML images) are handled in both static and dynamic modes for the WebGL 2 context.

src/backend/web-gl2 · high confidence

Introduce HeadlessGL backend for server-side GPU computation

Adds a new \HeadlessGLKernel\ class in \src/backend/headless-gl/kernel.js\ that extends the existing WebGL kernel to support headless rendering environments. This enables GPU-accelerated kernel execution in Node.js or other non-browser contexts by initializing a virtual GL context, detecting available extensions (such as texture float and draw buffers), and handling canvas resizing via the \STACKGL\_resize\_drawingbuffer\ extension. The implementation includes support for serializing the kernel state via \toString()\ for reuse and ensures proper cleanup of the GL context.

src/backend/headless-gl · high confidence

Major API restructuring and introduction of Pipeline and WebGPU backends

The library has undergone a significant architectural overhaul, introducing a new \Pipeline\ API that allows users to compile multi-kernel computations into a single callable plan with resident intermediates, and adding a \WebGPU\ backend (accessible via \mode: 'webgpu'\) alongside existing WebGL, WebGL2, CPU, and WebAssembly backends. The \GPU\ class now manages these backends through a unified \kernelOrder\ and supports an \async\ mode for non-blocking graphical kernel execution. Additionally, the \Input\ class now exposes a \toArray()\ method for easier data retrieval, and the global binding logic in \browser.js\ has been hardened to prevent conflicts with native WebGPU interfaces and strict-mode loads.

src · high confidence

New CPU backend implementation for kernel execution

The library now includes a CPU-based execution backend, allowing kernels to run in Node.js or environments without WebGL support. This new backend translates kernel logic into standard JavaScript, supporting features such as graphical output via HTMLCanvas, media input handling, and strict integer modes. It provides a fallback path for computation, ensuring broader compatibility across different runtime environments.

src/backend/cpu · high confidence

New WebAssembly backend for GPU computations

A new WebAssembly backend has been added to the library, enabling GPU-like computations to run in the browser or Node.js via WebAssembly. This includes a binary emitter for generating WASM modules, a function node walker for translating kernel logic, a kernel implementation with SIMD and threading support, a fused pipeline executor for efficient multi-step execution, and a worker pool for parallel processing. The backend supports both scalar and SIMD operations, with automatic fallback to scalar paths when SIMD is unavailable, and handles memory management with a bounded cache to prevent excessive memory usage.

src/backend/web-assembly · high confidence

New WebGPU backend with fused pipeline execution and graphical mode

Introduces a new WebGPU backend (mode 'webgpu') that enables high-performance GPU acceleration via compute shaders and storage buffers. This release adds a fused-encoder pipeline executor that batches multiple kernel steps into a single command submission for improved efficiency, and introduces a graphical mode where compute shaders write colors to a buffer that is then presented to a canvas. The backend is fully asynchronous, requiring users to await kernel results, and includes robust handling for device loss and resource management through a shared context singleton and refcounted buffer results.

src/backend/web-gpu · high confidence

New examples for TypeScript typing, JSON serialization, and GPU-accelerated simulations

Added several new demonstration files to the examples directory: \advanced-typescript.ts\ and \simple-typescript.ts\ showcase kernel type inheritance and TypeScript integration; \json-saving.js\ demonstrates serializing and deserializing kernels via JSON; \mandelbulb.html\, \mandelbrot-set.html\, \random.html\, \fluid.html\, and \internal-variable-precision.html\ provide visual examples of 3D fractals, random number generation, fluid dynamics, and variable precision rendering.

examples · high confidence

New video processing example with GPU acceleration

Added a new interactive example in \examples/video/index.html\ that demonstrates real-time video processing using GPU.js. The demo allows users to load a video source and apply graphical kernels to it, with UI controls to toggle GPU/CPU execution, flip the video axes, and alter color channels, while displaying the current frames per second.

examples/video · high confidence

WebGL backend refactored into modular components with precision tactics and bitwise support

The WebGL backend has been restructured into distinct modules (fragment-shader, function-node, kernel, kernel-value-maps, vertex-shader) to support a new precision system and improved type handling. The fragment shader now includes GLSL implementations for bitwise operations (AND, OR, XOR, NOT, shifts) and trigonometric functions (atan2, acosh, etc.), enabling correct behavior for these operators on the GPU. The kernel-value-maps module introduces a 'precision' setting ('unsigned' or 'single') that selects specific kernel value handlers, replacing the previous 'floatOutput' feature. The function-node module handles AST transpilation with support for scalar argument shadowing and strict integer division accuracy fixes. This modularization also supports dynamic output and argument handling, allowing kernels to switch types at runtime without full recompilation.

src/backend/web-gl · high confidence

Security

Removed unused filesystem code from vendored gl-wiretap to resolve security alert

The vendored gl-wiretap library has been updated to remove the unused \writePPM\ function, its associated \readPixelsFile\ option, and the \imageCount\ counter. Although this code was never executed by gpu.js, static analysis tools flagged the presence of \require('fs').writeFileSync\ in the generated transcript as a critical supply-chain risk. Removing this dead code eliminates the false-positive security alert without affecting the core WebGL recording functionality used for kernel export.

src/vendor · high confidence

Architecture

Introduce new backend compilation architecture with FunctionBuilder and FunctionNode

The backend compilation pipeline has been restructured into dedicated modules: \FunctionBuilder\ now orchestrates the state and conversion of function nodes, \FunctionNode\ handles the parsing and validation of individual function sources (including AST scanning and type tracking), and \FunctionTracer\ manages identifier and context tracking during AST traversal. This change replaces the previous monolithic compilation logic with a modular system that supports nested functions, dynamic argument types, and improved type inference for kernel arguments and constants.

src/backend · high confidence

Behavioural changes

Build and benchmark tooling migrated from Gulp to plain Node scripts

The project's build and benchmark tooling has been rewritten from Gulp to plain Node scripts. The build pipeline now uses rolldown instead of browserify, and the banner generation no longer depends on lodash.template. Several new benchmark scripts have been added to measure performance across different backends and configurations: benchmark-async.mjs measures main-thread availability under readback load, benchmark-pipeline-webgpu.mjs benchmarks the WebGPU fused-encoder pipeline against per-pass chaining in a browser, benchmark-pipeline.mjs performs the same comparison in plain Node, benchmark-webasm.mjs compares the WebAssembly backend against CPU and headlessGL, and benchmark-webgpu.mjs compares CPU, WebGL2, and WebGPU in a browser. Additionally, scripts/beautify.js replaces the previous Gulp beautify task, scripts/build-tests.js regenerates the test HTML file, and scripts/dev.js serves the repository for local testing.

scripts · high confidence

Replace triangle-distribution random noise with uniformly distributed PRNG

The plugin system now uses a new \math-random-uniformly-distributed\ plugin to replace the previous \math-random-triangle-noise\ implementation. This change alters the statistical distribution of values generated by \Math.random()\ replacements in shaders from a triangle distribution to a uniform distribution, providing more accurate random sampling. The new plugin also supports deterministic seeding via \kernel.randomSeed\, allowing for reproducible results across runs, whereas the previous implementation relied on a simple noise seed.

src/plugins · high confidence

Fixes

Refactored WebGL kernel generation and string serialization

The WebGL backend's kernel string generation and kernel class implementation have been restructured to improve reliability and feature support. The new \kernel-string.js\ module centralizes the logic for serializing kernel source code, handling argument uploads, and managing framebuffer readbacks for mapped outputs. The \GLKernel\ class now exposes detailed feature detection capabilities, including checks for float read accuracy, integer division precision, and speed tactic support, allowing the runtime to adapt to specific WebGL context limitations. This change also introduces support for \fixIntegerDivisionAccuracy\ and \setPrecision\ settings, ensuring correct numerical results in edge cases across different hardware.

src/backend/gl · high confidence

Refactored WebGL kernel value handling to fix texture binding and video sizing bugs

The WebGL backend's kernel value system has been restructured into specific modules (e.g., \array.js\, \html-image.js\, \single-input.js\) to resolve critical rendering issues. A key fix addresses video inputs that previously sampled arbitrary texels due to incorrect size detection; the new \mediaSize\ helper now correctly prioritizes \videoWidth\/\videoHeight\ over presentational attributes. Additionally, the refactoring introduces a \rebind()\ method to the \WebGLKernelArray\ base class, ensuring that texture bindings are correctly restored to their shared context units between kernel runs, which prevents one kernel's arguments from clobbering another's (issue \#862).

src/backend/web-gl/kernel-value · high confidence

Refactored WebGL texture backend with dedicated classes and reference counting

The WebGL texture backend has been restructured to use a hierarchy of specific texture classes (such as GLTextureFloat, GLTextureUnsigned, and their 2D/3D/array variants) instead of a monolithic implementation. This change introduces explicit reference counting (via the \\_refs\ property) to manage texture lifecycle, preventing memory leaks and framebuffer loss when textures are deleted or cloned. It also adds a \toArray()\ method to all texture types, allowing users to efficiently retrieve kernel output data as standard JavaScript arrays.

src/backend/gl/texture · high confidence

Update browser bundle to version 2.24.1

The distributed browser bundle (dist/gpu-browser-core.js) has been updated to version 2.24.1. This release includes the latest fixes and features for the GPU.js library, ensuring compatibility with the current build environment and providing the most recent bug fixes for kernel execution and backend support.

dist · high confidence

Test coverage

Add BrowserStack real-device and browser testing infrastructure; Added internal test suites for kernel features and resource management; Added regression tests for GPU.js kernel execution and compilation issues; Added test coverage for the new pipeline execution system; Added tests for kernel serialization with single-precision arguments and constants; Added unit tests for CPU and GL kernel internals; Added unit tests for FunctionNode safety checks; Added unit tests for WebGL kernel value texture size validation; Added unit tests for WebGL2 kernel value validation and argument setup; Added unit tests for WebGLFunctionNode AST handling; Added unit tests for WebGLKernel internal setup and validation logic; Expanded WebAssembly backend test coverage and browser test harness; Expanded test coverage for kernel argument types, custom functions, and async mode; WebGPU test suite added.

Dependencies

Update to gpu.js v2.24.1 with dependency and build tooling changes

The package is updated to version 2.24.1, introducing several dependency and build tooling changes. The \gl\ library has been upgraded to version 8.1.6 and moved to optional dependencies, while \acorn\ is pinned to 8.14.0 and \webgpu\ to 0.2.9. The build system has shifted from browserify to rolldown (v1.2.0), and the code coverage tool has been updated from istanbul to c8 (v10.1.2). Browser testing now utilizes Playwright (v1.62.0) alongside Selenium WebDriver (v4.27.0), and the minification tool has been updated to terser (v5.49.0).

(dependencies) · high confidence

Housekeeping

Project scaffolding and documentation updates

This change introduces foundational project documentation and configuration files, including a new CLAUDE.md detailing the build environment (Node 22, rolldown, terser), test execution, and release procedures; a CONTRIBUTING.md outlining pull request guidelines; an ISSUE\_TEMPLATE.md for bug reports; a LICENSE file under the MIT license; and a SECURITY.md defining vulnerability reporting and scope. It also adds a playwright.config.js for running the QUnit suite in real browsers (Chromium, WebKit, Firefox) via Playwright, and updates the .gitignore to exclude runtime data, coverage, and new test artifacts. Additionally, the legacy Ant build.xml file has been removed.

(repo-wide) · high confidence

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 51 → 48 (-3.0)
  • Rubric changed (rubric-2026.10.5 → rubric-2026.11.4) — scores are not directly comparable.

Lenses

  • Code Health 41 → 30 (-10.4)
  • Architecture 81 → 92 (+10.7)
  • Maturity 54 → 55 (+0.9)
  • Readiness 52 → 52 (+0.2)
  • Security 84 → 89 (+5.2)
  • Performance 74 → 89 (+14.3)

Resolved (34)

  • Deprecated: glob (package-lock.json)
  • FunctionTooLong: benchmark-pipeline-webgpu.benchInPage (scripts/benchmark-pipeline-webgpu.mjs)
  • FunctionTooLong: benchmark-webgpu.benchInPage (scripts/benchmark-webgpu.mjs)
  • High CVE: [GHSA redacted] (package-lock.json)
  • High CVE: [GHSA redacted] (package-lock.json)
  • High secret: WD-SECRET-0005 (package-lock.json)
  • Hotspot: src/backend/function-node.js (src/backend/function-node.js)
  • Hotspot: src/backend/kernel.js (src/backend/kernel.js)
  • Hotspot: src/backend/web-assembly/function-node.js (src/backend/web-assembly/function-node.js)
  • Hotspot: src/backend/web-assembly/kernel.js (src/backend/web-assembly/kernel.js)
  • Hotspot: src/backend/web-assembly/pipeline-executor.js (src/backend/web-assembly/pipeline-executor.js)
  • Hotspot: src/backend/web-gl/function-node.js (src/backend/web-gl/function-node.js)
  • Hotspot: src/backend/web-gl/kernel.js (src/backend/web-gl/kernel.js)
  • Hotspot: src/backend/web-gpu/function-node.js (src/backend/web-gpu/function-node.js)
  • Hotspot: src/backend/web-gpu/kernel.js (src/backend/web-gpu/kernel.js)
  • Hotspot: src/gpu.js (src/gpu.js)
  • Hotspot: src/kernel-run-shortcut.js (src/kernel-run-shortcut.js)
  • Hotspot: src/pipeline.js (src/pipeline.js)
  • Medium CVE: [GHSA redacted] (package-lock.json)
  • Off-boarding risk: anonymized user #1
  • …and 14 more

New (8)

  • Off-boarding risk: anonymized user #1
  • getWebGl spells Gl where 36 names in the project spell it GL (src/backend/kernel.js)
  • makeGpuWithPick spells Gpu where 14 names in the project spell it GPU (test/internal/hoisted-index-reads.js)
  • doc comments repeat the names (src/backend/kernel.js)
  • redundant comment (src/utils.js)
  • redundant comment (test/internal/function-node.js)
  • redundant comment (test/internal/function-node.js)
  • redundant comment (test/internal/function-node.js)

Changes since last survey

  • 3 commits — 2 feature/other, 1 fixes

By area

  • (root) — 3 commits

Notable commits

  • fix: fix(ci): Use plain minimatch/glob overrides so npm 10's npm ci accepts the lockfile
  • change: chore(deps): Override minimatch to 11.0.4 and glob to 14.0.3
  • change: chore(deps): Update ip-address to 10.7.5, http-cache-semantics to 4.3.0 and brace-expansion to 5.0.12

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

gpujs/gpu.js was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 15 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 290711d0f8ff1af95b291489898f73a5c1b85a7a — the exact code this score is about.
  • Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.65+preprod-3c33c1882dc1.