mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-16 12:21:35 +00:00
Same as Chrome's args, this allows us to set the DeviceDescriptor::forceEnabledToggles and forceDisabledToggles when creating the GPUDevice. Example: node cmdline.ts ... --gpu-provider-flag=enable-dawn-features=dump_shaders ... Bug: dawn:1163 Change-Id: Ib5db71355f72e5d08f8fe87313c5e3d63ee236c3 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66963 Commit-Queue: Antonio Maiorano <amaiorano@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
Dawn bindings for NodeJS
Note: This code is currently WIP. There are a number of known issues.
Building
System requirements
- CMake 3.10 or greater
- Go 1.13 or greater
Install depot_tools
Dawn uses the Chromium build system and dependency management so you need to install depot_tools and add it to the PATH.
Fetch dependencies
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
Build
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
Running WebGPU CTS
- Build the
dawn.node
NodeJS module. - Checkout the WebGPU CTS repo
- Run
npm install
from 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 ./src/dawn_node/tools/run-cts
with VK_ICD_FILENAMES=<swiftshader-cmake-build>/Linux/vk_swiftshader_icd.json
Known issues
- Many WebGPU CTS tests are currently known to fail
- Dawn uses special token values for some parameters / fields. These are currently passed straight through to dawn from the JavaScript. discussions: 1, 2, 3
- Backend validation is currently always set to 'full' to aid in debugging. This can be extremely slow. discussion
- Attempting to call
new T
in JavaScript, whereT
is an IDL interface type, should result in a TypeError "Illegal constructor". discussion GPUDevice
currently maintains a list of "lost promises". This should return the same promise. discussion
Remaining work
- Investigate CTS failures that are not expected to fail.
- Generated includes live in
src/
fordawn_node
, but outside for Dawn. discussion - Hook up to presubmit bots (CQ / Kokoro)
binding::GPU
will require significant rework once Dawn implements the device / adapter creation path properly.