Reference

API Reference

Browse generated API docs by topic. Every symbol comes from the docs manifest and deep-links to an anchor on its topic page.

Start with vgpu

initfunction

Creates the public `Gpu` context. `init()` creates the device only; canvas-backed rendering is explicit through `surface(gpu, canvas, opts)`.

import { init } from "vgpu";
Gpuclass

The main API (`vgpu`) context returned by `init()`. It owns device lifetime and the frame clock; every resource — canvas surfaces, offscreen targets, render, compute, storage, uniforms, samplers, and bundles — is created by a free function that takes the `Gpu` as its first argument.

import type { Gpu } from "vgpu";
import { init } from "vgpu/mock";
Effecttype

Fullscreen-fragment render unit created by `effect(gpu)`. Use it for post-processing, gradients, blurs, and screen/target copies; use `draw(gpu)` for meshes, vertex buffers, instancing, or explicit vertex counts.

import type { Effect, EffectOptions } from "vgpu";
Drawtype

Target-agnostic renderable shader unit created by `draw(gpu)`. It reflects WGSL bindings, caches pipelines per target format/depth/sample count, and supports geometries, explicit vertex counts, instancing, and raw group claims.

import type { DepthOptions, Draw, DrawOptions, DrawCallOptions, DrawLayoutOptions, GeometryLike, StencilFaceOptions, StencilOptions } from "vgpu";
Computetype

Compute pipeline created by `compute(gpu)`. It uses the same WGSL reflection and `set()` ownership rules as render draws, then `dispatch(x, y?, z?)` — or `dispatch({ indirect })` for GPU-driven counts — encodes and submits one compute pass.

import type { Compute, ComputeOptions, DispatchOptions, StorageAccess, StorageBuffer, StorageOptions } from "vgpu";
Frametype

`frame()` is both a callable one-frame submit helper and a `FrameRunner`. It creates one command encoder, lets you encode any number of explicit-target render passes, then submits once.

import type { Frame, FramePass, FramePassOptions, FrameLoopHandle, FrameRunner } from "vgpu";
Bundletype

Main API (`vgpu`) render bundle recorded by `bundle(gpu, { target }, cb)`. Bundles freeze commands, attachment formats, sample count, and bind-group identities for static work; `FramePass.bundles()` checks signature and resource staleness (`VGPU-R3-BUNDLE-STALE`) when replaying.

import type { Bundle, BundleOptions, BundleRecorder } from "vgpu";
Targettype

Offscreen render target abstraction used by passes, draws, bundles, and ping-pong resources. Targets own size, color formats, optional depth, MSAA resolve textures, and readback. Canvas-backed targets are `Surface` instances created with `surface(gpu, canvas)`.

import type { Target, TargetOptions, TargetTextureOptions, PingPongTargets, PingPongStorage } from "vgpu";
SharedUniformstype

Values-first shared uniform/storage object created by `uniforms(gpu, values)`. It adopts binary WGSL layout lazily from the first compatible shader binding and reuses one stable buffer across shaders.

import type { SharedUniforms } from "vgpu";
PingPongStoragetype

Offscreen render target abstraction used by passes, draws, bundles, and ping-pong resources. Targets own size, color formats, optional depth, MSAA resolve textures, and readback. Canvas-backed targets are `Surface` instances created with `surface(gpu, canvas)`.

import type { Target, TargetOptions, TargetTextureOptions, PingPongTargets, PingPongStorage } from "vgpu";

Packages

vgpu

Public API: init, Gpu, effect, draw, compute, frame, bundle, target, ping-pong, and uniforms.

41 symbols

vgpu/scene

Tree-shakeable geometry, camera, color, and orbit helpers without a retained scene graph.

85 symbols

@vgpu/wgsl

WGSL compile-time entry points, runtime resolution, reflection metadata, and bundler loaders.

15 symbols

@vgpu/wgsl-std

Standard WGSL modules for color, fullscreen triangles, hashes, and procedural noise.

26 symbols

vgpu/core

Advanced

Advanced escape hatches for native WebGPU handles, buffers, textures, bind groups, and structured uniforms.

35 symbols

@vgpu/render

Advanced

Advanced render tooling for inspection, performance measurement, utilities, and mesh editing.

50 symbols

@vgpu/adapter-node

Reference documentation for @vgpu/adapter-node.

2 symbols

vgpu/mock

Reference documentation for vgpu/mock.

1 symbols