Examples Gallery

Goldy ships with 21 Rust examples demonstrating scheme recording, compute-to-surface, graphics pipelines, and multi-window workflows. Every example uses Slang shaders and runs on shipped backends (Vulkan 1.4+, DX12, Metal Tier 2+). CUDA and WebGPU backends are in progress; Tenstorrent is planned.

Running Examples

cd goldy
cargo run --features examples --example <name> --release

All windowed examples support Escape to exit and automatic window-resize handling.


Bindless Basics

These examples cover fundamental Goldy patterns: vertex buffers, surfaces, uniforms, and fragment shaders.

ExampleWhat it demonstratesSource
triangleMinimal windowed program: retained scheme, offscreen render pass, present via SurfaceExchange.triangle.rs
gradientAnimated full-screen gradient driven by a time uniform. Uses vertex-less rendering and optional GOLDY_VALIDATE_LAYOUTS.gradient.rs
checkerboardProcedural animated checkerboard via UV distortion in a fragment shader.checkerboard.rs

Compute Workflows

Examples that use ComputePipeline and Scheme for GPU-side data processing, including compute-to-surface.

ExampleWhat it demonstratesSource
compute_particlesCompute updates particle positions; graphics renders instanced quads. Retained scheme scheduling.compute_particles.rs
game_of_lifeConway's Game of Life on the GPU with ping-pong sub-views in one retained mosaic parcel.game_of_life.rs
compute_to_surfacePure compute rendering — no RenderPipeline. Writes swapchain via SurfaceExchange::bind_destination.compute_to_surface.rs

Graphics Pipelines

Classic rendering techniques: depth testing, textures, instancing, and 3D projection.

ExampleWhat it demonstratesSource
solid_cubeSolid 3D cube with per-face colors and depth buffer.solid_cube.rs
spinning_cube3D wireframe cube using line primitives.spinning_cube.rs
depth_quadsDepth buffer proves draw-order independence.depth_quads.rs
textured_quadProcedural checkerboard texture on a quad.textured_quad.rs
instancingGPU-driven instancing with compute-updated transforms.instancing.rs
bouncing_linesLINE_LIST topology with simple physics.bouncing_lines.rs
waveformLINE_STRIP waveform visualizer.waveform.rs

Advanced Patterns

Fragment Shader Effects

ExampleWhat it demonstratesSource
plasmaDemoscene plasma effect.plasma.rs
tunnelFlying-through-a-tunnel polar-coordinate effect.tunnel.rs
metaballsMetaball field rendering.metaballs.rs
mandelbrotInteractive Mandelbrot explorer.mandelbrot.rs

Interactive and Multi-Window

ExampleWhat it demonstratesSource
digital_clock7-segment clock display.digital_clock.rs
starfield3D starfield with depth.starfield.rs
particlesRain/snow particle system.particles.rs
multi_windowMultiple windows sharing one device.multi_window.rs

Headless and Validation

ExampleWhat it demonstratesSource
headless_triangleOffscreen render + CPU readback via MemoryExchange.headless_triangle.rs
scheme_screenshotScheme-based screenshot capture for tests.scheme_screenshot.rs

Run all windowed examples interactively:

./run_all_examples.sh