HomeBookmarks
VGPUVGPU
VGPU

VGPU

Canonical WebGPU examples from VGPU.

VGby VGPU
24components330.1Kviews2.8Kbookmarks

Installs all 23 components. Without our CLI, run instead.

Auto-indexed

VGPU contents

  • Adaptive Quality

    Adaptive Quality

  • Particle Orbit

    Particle Orbit

  • Three.js WGSL modules

    Three.js WGSL modules

  • Earth

    Earth

  • Next.js Flare

    Next.js Flare

  • WGSL in three.js

    WGSL in three.js

  • Air Painting

    Air Painting

  • MNIST Classifier

    MNIST Classifier

  • Transmission

    Transmission

  • Optimized Black Hole

    Optimized Black Hole

  • Environment Map

    Environment Map

  • Interactive Fluid

    Interactive Fluid

  • Anti Aliasing

    Anti Aliasing

  • Instanced Rendering

    Instanced Rendering

  • Raymarched fractal

    Raymarched fractal

  • FFT ocean surface

    FFT ocean surface

  • Radiance Cascades

    Radiance Cascades

  • Clipping

    Clipping

  • Triangle LED Hero

    Triangle LED Hero

  • Glass Fractal

    Glass Fractal

  • Particles ocean

    Particles ocean

  • Agent Radiance Cascades

    Agent Radiance Cascades

  • Batch Rendering

    Batch Rendering

  • Black Hole

    Black Hole

  • That's all 24 components

    About VGPU

    VGPU publishes a shadcn registry at vgpu.sh, with 23 components installable through the shadcn CLI.

    Components
    23
    GitHub stars
    2,607
    Last commit
    Oct 16, 2026
    Repository
    vercel-labs/vgpu

    Also in the VGPU registry

    Copy a prompt for your agent, copy the install command, or open the docs that ship it.

    • Agent Radiance Cascades

      agent-radiance-cascades
    • Air Painting

      air-painting
    • Anti-Aliasing

    • Batch Rendering

      batch-rendering
    • Black Hole

      black-hole
    • Clipping

    • Depth Estimation

      depth-estimation
    • Earth

    • Environment Map

      environment-map
    • FFT ocean surface

      fft-ocean-surface
    • Glass Fractal

      glass-fractal
    • Instanced Rendering

      instanced-rendering
    • Interactive Fluid

      fluid
    • MNIST Classifier

      mnist-classifier
    • Next.js Flare

      nextjs-flare
    • Optimized Black Hole

      optimized-black-hole
    • Particles ocean

      fft-ocean
    • Radiance Cascades

      radiance-cascades
    • Raymarched fractal

      raymarched-fractal
    • Simple Gradient

      gradient
    • Transmission

    • Triangle LED Hero

      triangle-led-front
    • WGSL in three.js

      three-tsl

    From the VGPU readme

    vgpu

    vgpu is a TypeScript library for WebGPU: typed shader imports, a tiny gpu-first API, and the same code running in the browser, headless Node, and your test suite.

    • Typed WGSL imports. .wgsl files import and export like TypeScript modules, and reflection keeps binding names, types, and layouts correct without hand-written declarations.
    • One Gpu context. init() returns a single handle; every entry point (draw, effect, frame, surface, target, ...) takes it as its first argument. No hidden global state.
    • Small by design. Unused declarations are pruned before minification, and a complete fullscreen effect ships in 25 KB gzipped — a budget enforced in CI.
    • Multi-runtime by default. One public API surface across the browser, headless Node (vgpu/node, Dawn-backed), and a deterministic mock (vgpu/mock) built for tests and CI.
    • Explicit frames. frame(gpu, (f) => f.pass(target, effect)) — passes, clears, and draws are explicit calls, never implicit scene-graph state.
    • Agent-ready. Docs, the example gallery, and shader validation all run from the CLI (npx vgpu docs, npx vgpu examples, npx vgpu check), and vgpu.sh publishes agents.md and llms.txt for LLM consumption.

    View full documentation and examples on vgpu.sh.

    Quick Start

    pnpm add vgpu
    pnpm add -D @webgpu/types
    
    import { clock, init, effect, frameLoop, surface } from "vgpu";
    import waveShader from "./wave.wgsl";
    
    const gpu = await init();
    const canvasSurface = surface(gpu, canvas, { dpr: [1, 2] });
    const wave = effect(gpu, waveShader, { set: { speed: 2 } });
    
    const time = clock(gpu);
    frameLoop(gpu, (frame) => {
      wave.set({ time: time.time });
      frame.pass(canvasSurface, wave);
    });
    

    In this example, init() acquires an adapter and device and returns the single Gpu context; every other entry point takes it as its first argument. surface wraps the canvas as a render target and keeps its size current, clamping the device-pixel ratio between 1 and 2. effect compiles the shader into a fullscreen effect whose uniforms are addressed by their WGSL names through set() — writes land immediately, so the loop only sets what changes each frame. clock provides frame time, and frameLoop runs the callback once per frame, where frame.pass draws the effect into the surface.

    Node quick start

    The same API runs headless, against a Dawn-backed device:

    import { draw, frame, init, target } from "vgpu/node";
    import triangleShader from "./triangle.wgsl";
    
    const gpu = await init();
    const colorTarget = target(gpu, { size: [256, 256], format: "rgba8unorm" });
    const triangle = draw(gpu, { shader: triangleShader });
    
    frame(gpu, (f) => f.pass(colorTarget, triangle));
    const pixels = await colorTarget.read();
    gpu.dispose();
    

    vgpu/mock swaps in a deterministic software adapter for the same code, so tests never need a GPU.

    WGSL modules with typed imports

    .wgsl files import and export like TypeScript modules. @vgpu/wgsl-std ships reusable declarations (hash, noise, color, sampling, ...) as named exports, and any .wgsl file can export its own fn, struct, or const for other shaders to import:

    // grain.wgsl
    import { hash2 } from "@vgpu/wgsl-std/hash";
    
    export fn grain(uv: vec2f, time: f32) -> f32 {
      return hash2(uv * time).x;
    }
    

    Imports resolve at build time through typed WGSL reflection — no codegen step and no manual binding declarations to keep in sync.

    Documentation

    Full documentation lives on vgpu.sh. Start with Getting started, then the performance playbook for the defaults (bundles, target pre-warm, in-place set(), instancing, ping-pong, MSAA/depth) that shader authors should reach for from day one. Interactive examples run in the browser, and their source is what vgpu examples serves.

    The same guides and API reference also ship inside the package and run fully offline through the CLI:

    npx vgpu docs cat getting-started.md
    npx vgpu docs find effect
    

    Agent resources

    vgpu is built to be operated by coding agents as well as people. The example gallery is searchable from the CLI, and any example's complete source can be copied locally without cloning the repository:

    npx vgpu examples search "raymarching"
    npx vgpu examples pull  --out ./example
    

    Agents with skill support can install vgpu's thin documentation router. The skill contains no versioned API reference; it queries the docs bundled with the vgpu version installed in the project.

    npx skills add vercel-labs/vgpu
    
    • Agent readiness manifest — how agents should discover and use vgpu
    • llms.txt and llms-full.txt — documentation index and full export for LLMs
    • Examples discovery API — tokenless and read-only, described by OpenAPI
    • MCP guide — connect agents to the public read-only endpoint at https://vgpu.sh/api/mcp, or run local stdio for package-versioned docs and opt-in example downloads
    npx vgpu mcp
    npx vgpu mcp --project-from-cwd
    

    Packages

    This is a monorepo. The public entry point is vgpu; everything else backs it or ships independently.

    PackageWhat it is
    vgpuPublic main API: init, draw, compute, effect, frame, bundle, target, uniforms, plus scene and core subpaths.
    @vgpu/cliThe vgpu command-line binary: docs, shader check, doctor, and Dawn/software-renderer setup.
    @vgpu/coreLow-level WebGPU wrappers (Device, Buffer, Texture, bind groups) behind vgpu/core.
    @vgpu/wgslTurns .wgsl files into JS modules and resolves WGSL-to-WGSL imports before bundling.
    @vgpu/wgsl-stdStandard WGSL utility modules (math, color, sampling, noise, hash, ...).
    @vgpu/adapter-nodeDawn-backed adapter used by vgpu/node.
    @vgpu/adapter-mockDeterministic mock adapter used by vgpu/mock.
    @vgpu/renderSlim edit/inspect/utils/perf helpers outside the main rendering surface.

    Contributing

    See CONTRIBUTING.md for the development setup, bundle budgets, and release flow.

    License

    MIT — see LICENSE.

    Read the rest on GitHub →

    What VGPU shipped recently

    Every appearance and removal our crawl has seen in the registry index.

    • Agent Radiance CascadesaddedAug 31, 2026
    • Air PaintingaddedAug 31, 2026
    • Anti-AliasingaddedAug 31, 2026
    • Batch RenderingaddedAug 31, 2026
    • Black HoleaddedAug 31, 2026
    • ClippingaddedAug 31, 2026
    • Depth EstimationaddedAug 31, 2026
    • EarthaddedAug 31, 2026
    • Environment MapaddedAug 31, 2026
    • Particles oceanaddedAug 31, 2026
    • FFT ocean surfaceaddedAug 31, 2026
    • Interactive FluidaddedAug 31, 2026
    • Glass FractaladdedAug 31, 2026
    • Simple GradientaddedAug 31, 2026
    • Instanced RenderingaddedAug 31, 2026
    • MNIST ClassifieraddedAug 31, 2026
    • Next.js FlareaddedAug 31, 2026
    • Optimized Black HoleaddedAug 31, 2026
    • Radiance CascadesaddedAug 31, 2026
    • Raymarched fractaladdedAug 31, 2026

    Browse every shadcn registry we track →

    1. Components
    2. /
    3. VGPU
    4. /
    5. VGPU

    Related libraries

    Hirael

    Hirael

    by Mohammad Shehadeh

    218

    components

    ThreeUI

    ThreeUI

    by Meng To

    38

    components

    uiable

    uiable

    by uiable

    168

    components

    ShadcnSpace

    ShadcnSpace

    by ShadcnSpace

    188

    components

    Cnippet

    Cnippet

    by Cnippet

    347

    components

    Efferd

    Efferd

    by Efferd

    115

    components

    About VGPU

    VGPU is a component library on 21st.dev by VGPU with 24 public React components. Every component ships with a live interactive preview and full TSX source — copy the code, install it through the shadcn CLI, or pull it into Cursor or Claude Code over MCP.

    All 24 VGPU components

    • Adaptive Quality
    • Agent Radiance Cascades
    • Air Painting
    • Anti-Aliasing
    • Batch Rendering
    • Black Hole
    • Clipping
    • Earth
    • Environment Map
    • FFT ocean surface
    • Glass Fractal
    • Instanced Rendering
    • Interactive Fluid

    Browse all component libraries →

  • MNIST Classifier
  • Next.js Flare
  • Optimized Black Hole
  • Particle Orbit
  • Particles ocean
  • Radiance Cascades
  • Raymarched fractal
  • Three.js WGSL modules
  • Transmission
  • Triangle LED Hero
  • WGSL in three.js