This repository contains the example projects for the book The WebGPU Sourcebook: High-Performance Graphics and Machine Learning in the Browser by Matt Scarpino.
The projects in the chapters are given as follows:
- Ch02_ObjectCreation - Creates the JavaScript structures needed for WebGPU processing
- Ch03_BlueCanvas - Fills a WebGPU canvas with color
- Ch04_OrangeTriangle - Uses vertex attributes for rendering
- Ch04_MultiTriangle - Passes data from the vertex shader to the fragment shader
- Ch05_Cubes - Transforms objects using matrices stored in uniform buffers
- Ch06_ShinySphere - Implements Blinn-Phong shading in a fragment shader
- Ch06_SimpleTexture - Uses a texture to display an image in the scene
- Ch07_Text - Displays text by extracting regions from a texture atlas
- Ch08_SimpleCompute - Demonstrates a simple compute shader
- Ch08_DotProduct - Computes the dot product, demonstrates atomic functions and variables
- Ch09_IrisNetwork - Classifies irises using machine learning
- Ch10_SharpenImage - Sharpens an image in a compute shader
- Ch10_VideoProc - Reads frames from a video and converts them to grayscale
- Ch11_Transpose - Transposes a matrix using 4-by-4 blocks
- Ch11_MatrixMult - Multiplies matrices using transposition and vector operations
- Ch11_Reflection - Demonstrates vector reflection
- Ch11_QR - Performs QR factorization of a matrix
- Ch12_DFT - Analyzes audio using the Discrete Fourier Transform (DFT)
- Ch12_FFT - Analyzes audio using the Fast Fourier Transform (FFT)
The example projects in the appendices are:
- AppA_HelloTS - Demonstrates TypeScript compilation
- AppA_Triangle - Shows how a WebGPU application can be coded in TypeScript
- AppB_SimpleWasm - Shows how Emscripten can be used to compile C++ to WebAssembly
- AppB_DawnTriangle - Compiles Google Dawn into a web application