~11kB gzipped
WebGPU Ready

ralph-gpu

A minimal, ergonomic WebGPU shader library for creative coding and real-time graphics.

TypeScript
import { gpu } from "ralph-gpu";
 
const ctx = await gpu.init(canvas);
 
const gradient = ctx.pass(`
  @fragment
  fn main(@builtin(position) pos: vec4f) -> @location(0) vec4f {
    let uv = pos.xy / globals.resolution;
    return vec4f(uv, sin(globals.time) * 0.5 + 0.5, 1.0);
  }
`);
 
function frame() {
  gradient.draw();
  requestAnimationFrame(frame);
}
frame();

Everything You Need

Built for creative coders who want to harness the power of WebGPU without the complexity.

~11kB Gzipped

Tiny footprint. Full WebGPU power without the bloat.

Simple API

Write shaders, draw them. No boilerplate, no complexity.

Auto-Injected Uniforms

resolution, time, deltaTime, frame, and aspect available in all shaders automatically.

Ping-Pong Buffers

First-class support for iterative effects like fluid simulations and blur.

Reactive Uniforms

Use the familiar { value: X } pattern for reactive uniform updates.

Compute Shaders

GPU-accelerated parallel computation with full texture support.

Custom Samplers

Explicit control over texture filtering and wrapping. Reusable across shaders.

Storage Textures

Write directly to textures from compute shaders for advanced effects.

Blend Modes

Presets for additive, alpha, multiply, screen, and custom blending.

Explore the Docs