Small examples of SPIR-V compatible WebGPU usage.
- Blank: Setting up a swap chain and clearing the canvas.
- Point: Creating a pipeline and drawing a single point.
- Triangle: Creating vertex buffers and drawing a triangle.
- Cube: Creating vertex and uniform buffers, and animating a cube.
- Textured, Lit Cube: Creating a texture from a DOM image, setting up vertex and uniform buffers, and animating a cube.
- Particles: Simulating gravity on instanced particles using a compute shader.
Examples currently only run in Chrome Canary with the enable-unsafe-webgpu
flag set. See the Implementation Status page for updates on support.
All examples are implemented as simple HTML pages and can thus be run locally by serving them from a local HTTP server, e.g. python -m SimpleHTTPServer
.