What are the correct ways of building Dawn targeting the web (and so not native) on windows?

Skip to first unread message

Emil Fransson

Jan 20, 2023, 10:05:45 AM1/20/23
to Dawn Graphics

I am currently trying to use the CppHelloTriangle sample for rendering to web instead of natively. As in, I would like to use emscripten and run it in the chrome canary browser instead.

It IS working for native, and so I have succesfully set up Dawn correctly. What are the necessary major steps I now must take in order to compile it with emscripten? As it is a sample some of you might be familiar with I thought that converting it to rendering in web would be knowledge you have.

Directly calling "emcmake cmake" to build will cause Dawn to recognize the build system as UNIX (or unix-like as cmake says) and cause the build to look for the X11 library, which it cant find (I am on a windows machine). Since I would like to target the web I do not understand why it would need X11. 

I can see how I would face other problems too, however as of right now I simply can't find a way to build the program.

Can you help me?

Mark Sibly

Jan 20, 2023, 4:30:32 PM1/20/23
to Dawn Graphics
Chrome Canary already has dawn 'built-in', you just need to enable it on the 'chrome://flags' page. The setting you need to enable is called 'Unsafe WebGPU '.

Recent versions of emscripten have excellent built-in webgpu support, you just need to add '-sUSE_WEBGPU' to the em++ command line options when linking.The headers are <webgpu/webgpu.h> and <webgpu/webgpu_cpp.h>.

This repository has a simple example of using dawn/webgpu with emscripten: https://github.com/cwoffenden/hello-webgpu.git

Good luck!
Reply all
Reply to author
0 new messages