This directory contains examples of how to use gpu.cpp.
Each example is a standalone project that can be built and run independently by
running make from within the example directory.
Before running any of these examples, make sure you've downloaded the Dawn
native webgpu installation binary by running make dawnlib from the root
directory of the repository.
| Example | Description |
|---|---|
| hello_world | Minimal example to get started with gpu.cpp, implements a GELU neural network activation function. |
| gpu_puzzles | Implementation of Sasha Rush's GPU puzzles. |
| shadertui | An example of runtime live reloading of WGSL - demonstrated using a terminal shadertoy-like scii rendering. |
| render | GPU ascii rendering of a signed distance function for two rotating 3D spheres. |
| physics | Parallel physics simulation of a double pendulum with each thread starting at a different initial condition. |
| web | A minimal example of how to use gpu.cpp to build a WebAssembly module that runs in the browser. Before building this example, make sure you've installed the emscripten sdk by following the instructions here and run source emsdk_env.sh from the emsdk/ directory that was created when you cloned the emscripten repository. |
