About

webgpu.market is a library of WebGPU modules distributed as source code. Each module implements a single GPU technique as TypeScript + WGSL files. The source, a live demo, and further reading are included.

Not a framework

Modules operate directly on WebGPU objects — GPUDevice, GPUTexture, GPUBuffer. They don’t manage a scene graph, render loop, or resource lifecycle.

They work in any project that has a GPUDevice — Three.js, Babylon.js, Pixi.js, or no framework at all.

The WGSL is vanilla — no preprocessor, no custom syntax. The .wgsl files work in Rust/wgpu, Python/wgpu-py, or C++/Dawn without modification.

Why source code instead of packages

GPU code doesn’t compose like regular JavaScript. A noise function is a WGSL function you inline into your shader. A radix sort is a sequence of compute dispatches with caller-managed buffers.

  • WGSL has no import system. Using a noise function inside a shader requires the source file.
  • Workgroup sizes, texture formats, and buffer layouts vary by project.
  • GPU state is global. Two packages with different versions of a utility can’t share bind group layouts or pipeline caches.

npx webgpu-market add noise copies the TypeScript and WGSL files into src/webgpu-market/noise/. The files are static — they aren’t linked to a registry.

How modules work

Modules don’t allocate the textures or buffers they write into. The caller creates a GPUTexture, passes it to the module, and the module populates it. Modules expect a GPUDevice from the caller and never request their own adapter.

Each module has a destroy() method for its internal resources (pipelines, uniform buffers). It does not destroy caller-provided textures or buffers.

Each module includes a further-reading.md with links to the original papers and reference implementations.

Prior art

Same distribution model as shadcn/ui.