Skip to content

Commit

Permalink
Update README for the Dawn path.
Browse files Browse the repository at this point in the history
  • Loading branch information
juj committed Nov 30, 2022
1 parent 32b0d98 commit a1715fa
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# WebGPU in Wasm via Emscripten
# WebGPU in Wasm via Emscripten (or Dawn)

<img align=right src='./screenshots/webgpu-logo.svg' width=27%>

Expand All @@ -20,10 +20,18 @@ Additionally, if you are using Closure Compiler, also copy the Closure externs f

<img align=right src='./screenshots/emscripten-logo.svg' width=30%>

Then `#include "lib_webgpu.h"` to access the API, compile in `lib_webpgu.cpp` with the rest of your project files, and finally link with `--js-library /absolute/path/to/lib_webgpu.js` on the Emscripten command line to include the code. See the provided [CMakeLists.txt](https://github.com/juj/wasm_webgpu/blob/main/samples/CMakeLists.txt) for example usage.
Then `#include "lib_webgpu.h"` to access the API, compile in `lib_webpgu.cpp` and `lib_webgpu_cpp20.cpp` with the rest of your project files, and finally link with `--js-library /absolute/path/to/lib_webgpu.js` on the Emscripten command line to include the code. See the provided [CMakeLists.txt](https://github.com/juj/wasm_webgpu/blob/main/samples/CMakeLists.txt) for example usage.

For your convenience, a forward declaration header is also provided, and can be included with `#include "lib_webgpu_fwd.h"`.

# Using WebGPU via Dawn

It is also possible to target WebGPU outside the browser via Dawn. When doing so, also compile the dawn-specific file with your project:

- [lib/lib_webgpu_dawn.cpp](https://github.com/juj/wasm_webgpu/blob/main/lib/lib_webgpu_dawn.cpp)

TODO: add more instructions about targeting Dawn natively.

## Implementation Status

The repository was last updated to be up to date with the WebGPU specification as of 🗓 **18th of November 2022**.
Expand Down

0 comments on commit a1715fa

Please sign in to comment.