Note: This code is currently WIP. There are a number of known issues.
Dawn uses the Chromium build system and dependency management so you need to install depot_tools and add it to the PATH.
First, the steps are similar to
doc/building.md, but instead of the
Get the code step, run:
# Clone the repo as "dawn" git clone https://dawn.googlesource.com/dawn dawn && cd dawn # Bootstrap the NodeJS binding gclient configuration cp scripts/standalone-with-node.gclient .gclient # Fetch external dependencies and toolchains with gclient gclient sync
Currently, the node bindings can only be built with CMake:
mkdir <build-output-path> cd <build-output-path> cmake <dawn-root-path> -GNinja -DDAWN_BUILD_NODE_BINDINGS=1 -DDAWN_ENABLE_PIC=1 ninja dawn.node
npm installfrom inside the CTS directory to install its dependencies
./src/dawn_node/tools/run-cts --cts=<path-to-webgpu-cts> --dawn-node=<path-to-dawn.node> [WebGPU CTS query]
If this fails with the error message
TypeError: expander is not a function or its return value is not iterable, try appending
--build=false to the start of the
run-cts command line flags.
To test against SwiftShader instead of the default Vulkan device, prefix
Tis an IDL interface type, should result in a TypeError “Illegal constructor”. discussion
GPUDevicecurrently maintains a list of “lost promises”. This should return the same promise. discussion
dawn_node, but outside for Dawn. discussion
binding::GPUwill require significant rework once Dawn implements the device / adapter creation path properly.