Hello everyone,
Over the last weekend, I've been wrestling to get the C entry points to dawn's webgpu implementation loadable from a single shared library on mac-arm64, linux64 and win64. It's been difficult trying to get everything to cooperate, but I'm excited to share that it is possible and you can try the proof-of-concept at
https://github.com/jspanchu/webgpu-dawn-binaries/releases/tag/v127.0.6531.1! Please don't use in production yet.
The single dawn library exposes pure C functions of dawn's webgpu impl and tests it in CI across the three platforms. The POC is interesting in some ways:
1. it pulls in `depot_tools` uses `gclient sync` from cmake, so you don't even need to manually install depot_tools and what not. All you need is git, CMake, a recent C++ compiler, hope and patience. Reason to prefer `gclient sync` is its stability over `fetch_dawn_dependencies.py`, I hope this changes in the future.
2. final library size is more conservative. it's smaller than that generated by dawn's existing BundleLibraries.cmake by 3MB
Here's the bundle sizes across different OS:
du -bsh webgpu-dawn-127.0.6531-*/*/*dawn.{dll,so,dylib}
8.0M
webgpu-dawn-127.0.6531-win64/bin/dawn.dll
15M
webgpu-dawn-127.0.6531-Linux/lib/libdawn.so
7.6M
webgpu-dawn-127.0.6531-Darwin/lib/libdawn.dylib
Over the next couple weeks, I plan to slowly adapt/overhaul the CMake build system in dawn so that one may obtain these libraries directly by building from source. Ideally, I wish to see webgpu_dawn be a thing people download using apt/dpkg/dnf/choco/vcpkg/etc. There will be lots of issues but I think we can figure them along the way :)