The Dusk repository contains examples of small programs using the WebGPU native API.
This is not an officially supported Google product.
gitcmake3.22 or laterninjaclangorgcc
git submodule init
git submodule update
mkdir -p out/Debug
cd out/Debug
cmake -GNinja ../..
ninja
Dawn has a lot of dependencies, in order to simplify things we're using git submodules to handle the heavy lifting of checkout out all the needed dependencies.
The examples are using CMake for build configuration. The CMake is pretty
standard, c++23 is used for a few of the newer features. When linking the
executables we add the following to the target_link_libraries:
webgpu_dawnwebgpu_cppwebgpu_glfwglfw
The last two are only needed because GLFW is being used for the window
management. If something else is providing the window, and code is written to
create the needed surface, the last two libraries can be removed.
The following examples are provided: