Concepts
The core ideas behind every vgpu program, in reading order.
These ideas cover every vgpu program. Read them in order — each page builds on the previous one.
Context
init() creates the Gpu context; every surface, target, effect, and frame is created from it.
WGSL modules
Split shaders into reusable files with import and export; vgpu resolves the graph into ordinary WGSL.
Draws
draw(gpu, opts) renders geometry with custom vertex buffers — you write the vertex stage, geometry(gpu, ...) supplies the buffers.
Compilation
Pipelines compile lazily on first use; pre-warm them during load so the first frame doesn't hitch.
Effects
An effect is a full-screen fragment shader; chain effects by binding a target as another effect's input.
Passes
A pass composites any number of draws into one target; a single shader can draw directly.
Frames
frame(gpu, cb) encodes your passes and submits once; frameLoop(gpu, cb) drives animation.
Render bundles
bundle(gpu, opts, record) records draws once; replaying them each frame skips re-encoding.