Examples Gallery
Goldy ships 24 Rust examples, each a complete runnable program. Every example has a page here with a recording of it running, plus its Rust and Slang source inlined straight from the repository — so what you watch is what the code does, and what you read is what compiles.
The clips are not screen-captured from a desktop window. scripts/record_example_captures.sh
runs each example headlessly: the example writes packed RGBA pixels, and ffmpeg stitches them
into a WebM. Rerun it after changing an example's visuals.
Running Examples
cargo run --features examples --example <name> --release
All windowed examples exit on Escape, handle window resizes, and auto-exit after a soak
period that GOLDY_EXAMPLE_TIMEOUT overrides. To run every example back to back:
./run_all_examples.sh
GOLDY_BACKEND=webgpu ./run_all_examples.sh
EXAMPLE_TIMEOUT=10 ./run_all_examples.sh
Backends
The examples run on every shipped backend — Vulkan 1.4+, DX12, and Metal Tier 2+ — and on the
in-progress WebGPU backend, selected with GOLDY_BACKEND (see
Backend Architecture):
GOLDY_BACKEND=webgpu cargo run --no-default-features --features webgpu,examples --example triangle
Two examples probe capabilities and exit cleanly when they are missing:
mesh_triangle needs mesh shaders and ray_query needs
ray query. Capture skips writing a clip when the adapter used for recording lacks the
capability.
Headless capture does not present to a window, so it works on Vulkan (including lavapipe)
without a Wayland or X11 display. GOLDY_BACKEND still selects the backend when you want
WebGPU or CUDA instead.
Bindless Basics
Fundamental Goldy patterns: vertex buffers, surfaces, uniforms, and fragment shaders.
| Example | What it demonstrates |
|---|---|
triangle | Minimal windowed program: retained scheme, offscreen render pass, present via SurfaceExchange. |
mesh_triangle | The triangle present path driven by MeshPipeline and dispatch_mesh. |
gradient | Animated fullscreen gradient from a time uniform, with vertex-less rendering. |
checkerboard | Procedural animated checkerboard via UV distortion in a fragment shader. |
Compute Workflows
ComputePipeline and Scheme for GPU-side data processing, including compute-to-surface.
| Example | What it demonstrates |
|---|---|
compute_particles | Compute updates particle positions; graphics renders instanced quads. |
game_of_life | Conway's Game of Life with ping-pong sub-views in one retained mosaic parcel. |
compute_to_surface | Pure compute rendering — no RenderPipeline, writes the drawable directly. |
ray_query | Triangle BLAS/TLAS with inline RayQuery in [goldy_compute]. |
tensor_algebra | Headless dense tensors: fill, broadcast, and GEMV via TensorRecorder. |
Graphics Pipelines
Classic rendering techniques: depth testing, textures, instancing, and 3D projection.
| Example | What it demonstrates |
|---|---|
solid_cube | Solid 3D cube with per-face colours and a depth buffer. |
spinning_cube | 3D wireframe cube using line primitives. |
depth_quads | Depth buffer proves draw-order independence. |
textured_quad | Procedural texture on a quad with stage-local resources. |
instancing | GPU-driven instancing with compute-updated transforms. |
bouncing_lines | LINE_LIST topology with simple compute-driven physics. |
waveform | LINE_STRIP waveform visualizer. |
Fragment Shader Effects
Screen-space effects with no geometry beyond a fullscreen triangle.
| Example | What it demonstrates |
|---|---|
plasma | Demoscene plasma effect. |
tunnel | Flying-through-a-tunnel polar-coordinate effect. |
metaballs | Metaball field rendering. |
mandelbrot | Interactive Mandelbrot explorer. |
Interactive and Multi-Window
Input handling, runtime state changes, and more than one surface per device.
| Example | What it demonstrates |
|---|---|
digital_clock | Seven-segment clock display with CPU-generated geometry. |
starfield | 3D starfield with compute-driven star recycling. |
particles | Rain and snow particle system with a runtime mode switch. |
multi_window | Three windows sharing one device. |
Shared Code
Examples share a small amount of scaffolding — FPS reporting, run limits, hidden-window
creation, headless RGBA capture (GOLDY_EXAMPLE_CAPTURE), and surface-matched pipeline
rebuilds. See Shared Helpers.