Use Vulkan/D3D12 like API for the web with emscripten and the webgpu bindings.
You can build the project using Emscripten's CMake wrapper.
- First, install cmake and emscripten and gcc/clang
- Then, run the following or build with the vscode "build emscripten" task:
mkdir emcmake-build && cd emcmake-build
emcmake cmake ..
cmake --build .
- After the build, you can then run a webserver in the build directory and view the application in a browser that supports WebGPU (e.g. Chrome Canary with enabled feature flag):
php -S localhost:8000
# navigate to localhost:8000
You can also build the project for native (linux only for now, windows soon).
- First, install cmake and gcc/clang and build dawn
- Then run the following or run the "build native debug/release" vscode task:
mkdir -p native-build && cd native-build
cmake .. -DDawn_DIR=<path to dawn build> && cmake --build .
- Then run the app:
./native-build/webgpu
or launch with the vscode task