vercel-labs/vgpu

Modular cross-runtime WebGPU library for shaders, 3D scenes, GPU tensors, neural networks, and math viz

What it solves

vgpu simplifies the development of WebGPU applications by removing the friction of manual shader binding declarations and providing a consistent API that works across different environments. It eliminates the need for separate codebases for browser-based rendering, headless Node.js execution, and automated testing.

How it works

The library provides a unified Gpu context handle that manages the adapter and device. It uses a reflection system to treat .wgsl shader files as TypeScript modules, allowing developers to import and export shader functions and constants without manual codegen. It supports three distinct runtimes: the browser, a Dawn-backed headless Node.js environment, and a deterministic software mock for CI/CD and testing.

Who it’s for

Graphics programmers and web developers who want to build high-performance GPU-accelerated applications with WebGPU while maintaining a type-safe workflow and cross-runtime compatibility.

Highlights

  • Typed WGSL Imports: Shaders act like TypeScript modules with automatic reflection for binding names and types.
  • Multi-Runtime Support: Single API surface for browser, headless Node, and mock environments.
  • Agent-Ready: Includes a CLI for documentation and example discovery, and provides llms.txt and MCP support for AI coding agents.
  • Small Footprint: Enforces strict bundle budgets in CI to keep the library lightweight (e.g., a fullscreen effect in 25 KB gzipped).
  • Explicit Frame Control: Uses an explicit call-based approach for passes and draws rather than an implicit scene-graph state.

Related

  • Project
  • Project
  • Project
  • Project
  • Project