cwoffenden / hello-webgpu

Cross-platform C++ example for WebGPU and Dawn
262 stars 36 forks source link

Compile with Linux Subsystem for the web #14

Closed ghost closed 2 years ago

ghost commented 2 years ago

Hello, Im using WSL with Emscripten and I just cant get it to compile. I ran cmake . cmake --build . and it fails with fatal error: webgpu/webgpu.h: No such file or directory

cwoffenden commented 2 years ago

For Emscripten you need to use emcmake, for example:

emcmake cmake -B out/web -DCMAKE_BUILD_TYPE=Release
cmake --build out/web

I've not used Emscripten with WSL (only directly with Windows, Mac and Linux) but this should work.

ghost commented 2 years ago

That worked thanks. I am running now into the issue that Chrome throws the Error "No support for WebGPU; not starting" and shows nothing. I tried starting it via the command line (im running chrome on windows) with chrome.exe --enable-unsafe-webgpu and chrome.exe --enable-features=WebGPUService,WebGPU to no effect. These examples are running though: https://austin-eng.com/webgpu-samples

cwoffenden commented 2 years ago

I'm only maintaining compatibility with the latest version of the API (which is in flux whilst being finalised), so you'll need to use Chrome Canary for testing until Chrome catches up.

The samples in the link are written to work in older and newer versions of the spec.

ghost commented 2 years ago

Ok, installing Chrome Canary from https://www.google.com/chrome/canary/ and then enabling WebGPU under chrome://flags/#enable-unsafe-webgpu worked. Thanks a lot for you help!

cwoffenden commented 2 years ago

Eventually Chrome releases catch up with Canary and it'll just work.

(I'll add specific build instructions for Emscripten to the readme)