Skip to content

Commit c78a68d

Browse files
authored
Roll emdawnwebgpu port to v20250807 (#24889)
From https://github.com/google/dawn/releases/tag/v20250807.221415 This version includes the last breaking change to the core API and fixes the known showstopping bugs. It also improves the documentation included in the port file so it's easier to understand what to do with it. After this has landed for a little while it will be a good time to finally remove -sUSE_WEBGPU from Emscripten. (#24265)
1 parent 10a4a9e commit c78a68d

File tree

2 files changed

+96
-25
lines changed

2 files changed

+96
-25
lines changed

test/test_emdawnwebgpu_link_test.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
int main() {
1717
printf("%p\n", wgpuAdapterInfoFreeMembers);
1818
printf("%p\n", wgpuCreateInstance);
19-
printf("%p\n", wgpuGetInstanceCapabilities);
19+
printf("%p\n", wgpuGetInstanceFeatures);
20+
printf("%p\n", wgpuGetInstanceLimits);
2021
printf("%p\n", wgpuGetProcAddress);
22+
printf("%p\n", wgpuHasInstanceFeature);
2123
printf("%p\n", wgpuSupportedWGSLLanguageFeaturesFreeMembers);
2224
printf("%p\n", wgpuSupportedFeaturesFreeMembers);
2325
printf("%p\n", wgpuSurfaceCapabilitiesFreeMembers);

tools/ports/emdawnwebgpu.py

Lines changed: 93 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,49 +3,113 @@
33
# University of Illinois/NCSA Open Source License. Both these licenses can be
44
# found in the LICENSE file.
55

6+
# https://dawn.googlesource.com/dawn/+/80062b708e44aa4d8c48e555ed0cc801396069f6/src/emdawnwebgpu/pkg/README.md
67
r"""
8+
The full README of Emdawnwebgpu follows.
9+
710
# Emdawnwebgpu
811
912
Emdawnwebgpu is Dawn's implementation of webgpu.h for Emscripten (on top of the
1013
WebGPU JS API). It is a fork of Emscripten's original `USE_WEBGPU` bindings,
1114
and while it is maintained in Dawn, it works in any browser supporting WebGPU
1215
(modulo individual feature support).
1316
14-
The package includes all of the necessary files to use
15-
`<webgpu/webgpu.h>` and the Dawn-style `<webgpu/webgpu_cpp.h>` with Emscripten.
17+
Emdawnwebgpu provides everything necessary to use `<webgpu/webgpu.h>` and the
18+
Dawn-style `<webgpu/webgpu_cpp.h>` with Emscripten.
19+
20+
<!-- TODO(crbug.com/430616385): Link to a sample project. -->
21+
22+
If you find an issue in this release, please download the latest Emdawnwebgpu
23+
release (see below) and latest Emscripten and verify the bug, then report it at
24+
<https://crbug.com/new?component=1570785&noWizard=True>.
25+
26+
## API Stability
27+
28+
Core parts of `webgpu.h` (defined in
29+
<https://github.com/webgpu-native/webgpu-headers>) are considered stable APIs
30+
and should not change, except for bugfixes (though guarantees are not made).
31+
Dawn/Emscripten-specific parts, and all of `webgpu_cpp.h`, are **NOT**
32+
considered stable, and may change.
33+
34+
## How to use Emdawnwebgpu
35+
36+
Emdawnwebgpu is distributed in several ways. Choose the one that works for you.
37+
38+
In all cases, it is important to enable Closure to reduce code size in release
39+
builds. Pass the following flag to `emcc` during linking:
40+
41+
--closure=1
42+
43+
### Targeting Web only
44+
45+
#### Easiest: "Remote" port built into Emscripten
46+
47+
Recent releases of Emscripten vendor a copy of a "remote" port which
48+
automatically downloads a pinned version of Emdawnwebgpu and configures it.
49+
50+
Pass the following flag to `emcc` during both compilation and linking:
1651
17-
Find new versions of this package at <https://github.com/google/dawn/releases>.
52+
--use-port=emdawnwebgpu
1853
19-
If you find any issue with this release, please verify it in the latest release,
20-
and then report it at <https://crbug.com/new?component=1570785&noWizard=True>.
54+
#### Latest: "Remote" port from Dawn release
2155
22-
## How to use this package
56+
This is the same as the built-in port, but you can download a newer version if
57+
you need recent bugfixes or features in Emdawnwebgpu that haven't been rolled
58+
into Emscripten yet. **Requires Emscripten 4.0.10+.**
2359
24-
First, start with either:
60+
Download and extract the `emdawnwebgpu-*.remoteport.py` file from
61+
<https://github.com/google/dawn/releases>.
2562
26-
- A "remote" port file `emdawnwebgpu-v*.remoteport.py` (requires Emscripten 4.0.10+).
27-
- An `emdawnwebgpu_pkg` containing a local port file `emdawnwebgpu.port.py`.
28-
(Either from a pre-built zip release, or from a Dawn build output directory.)
63+
Pass the following flag to `emcc` during both compilation and linking:
2964
30-
## How to use this package (local or remote)
65+
--use-port=path/to/emdawnwebgpu_remoteport_file.py
3166
32-
Pass the following flag to `emcc`, during both compile and link, to set the
33-
include paths and link the implementation:
67+
#### Latest, without automatic downloading: "Local" port from Dawn release
3468
35-
--use-port=path/to/emdawnwebgpu_port_or_remoteport_file.py
69+
Use this method if your build system requires sources to be local (e.g. checked
70+
into your repository) instead of automatically downloaded, or if you use
71+
Emscripten before 4.0.10.
72+
**Note that Emdawnwebgpu may not work with older Emscripten releases.**
3673
37-
If (and only if) using Emscripten before 4.0.7, also pass this flag during link:
74+
Download and extract the `emdawnwebgpu_pkg-*.zip` package from
75+
<https://github.com/google/dawn/releases>.
76+
(Note the package is text-only and does not contain any binaries, but see below
77+
if you need to build the package from the original source.)
78+
79+
Pass the following flag to `emcc` during both compilation and linking:
80+
81+
--use-port=path/to/emdawnwebgpu_pkg/emdawnwebgpu.port.py
82+
83+
If (and only if) using Emscripten before 4.0.7, pass this flag during linking:
3884
3985
--closure-args=--externs=path/to/emdawnwebgpu_pkg/webgpu/src/webgpu-externs.js
4086
87+
### Cross-targeting Web/Native
88+
89+
#### Using CMake
90+
91+
Use this method if your project uses CMake and targets both Emscripten and
92+
native platforms.
93+
94+
<https://developer.chrome.com/docs/web-platform/webgpu/build-app>
95+
96+
#### Building the package locally to use with a non-CMake project
97+
98+
If your project already has Dawn source, or you otherwise want to cross-target
99+
Web and native with your non-CMake project, you can use CMake to build
100+
`emdawnwebgpu_pkg` locally (similar to how you would build binary libraries
101+
to link with in native), then use the "Local" port instructions above.
102+
103+
<https://dawn.googlesource.com/dawn/+/refs/heads/main/src/emdawnwebgpu/README.md>
104+
41105
## Port options
42106
43107
Options can be set by appending `:key1=value:key2=value` to `--use-port`.
44108
For information about port options, run:
45109
46110
emcc --use-port=emdawnwebgpu:help
47-
emcc --use-port=path/to/emdawnwebgpu.port.py:help
48-
emcc --use-port=path/to/emdawnwebgpu-*.remoteport.py:help
111+
emcc --use-port=path/to/emdawnwebgpu_remoteport_file.py:help
112+
emcc --use-port=path/to/emdawnwebgpu_pkg/emdawnwebgpu.port.py:help
49113
50114
### C++ bindings
51115
@@ -55,25 +119,30 @@
55119
`webgpu_cpp.h`, etc.), you can set the option `cpp_bindings=false`:
56120
57121
--use-port=emdawnwebgpu:cpp_bindings=false
58-
--use-port=path/to/emdawnwebgpu.port.py:cpp_bindings=false
59-
--use-port=path/to/emdawnwebgpu-*.remoteport.py:cpp_bindings=false
122+
--use-port=path/to/emdawnwebgpu_remoteport_file.py:cpp_bindings=false
123+
--use-port=path/to/emdawnwebgpu_pkg/emdawnwebgpu.port.py:cpp_bindings=false
60124
61125
## Embuilder
62126
63127
If your build process needs a separate step to build the port before linking,
64128
use Emscripten's `embuilder`.
65129
66130
Under `embuilder`, some options cannot be set automatically, so they must be
67-
set manually. See `OPTIONS` in `emdawnwebgpu.port.py` for details.
131+
set manually. For details, see `OPTIONS` in `emdawnwebgpu.port.py` (in the
132+
package zip).
68133
"""
69134

70-
TAG = 'v20250531.224602'
135+
TAG = 'v20250807.221415'
71136

72137
EXTERNAL_PORT = f'https://github.com/google/dawn/releases/download/{TAG}/emdawnwebgpu_pkg-{TAG}.zip'
73-
SHA512 = 'e3db5b2a4cc97cbb9b8a0c1f6fe7a740bf644322dfa4641a7b0902c192c58205d76acb9b359a0d6da1fdc9795e85eb1cf1927aa47f2a82814ee29868fef6670e'
138+
SHA512 = 'ab9f3af2536ef3a29c20bb9c69f45b5ee512b8e33fb559f8d0bf4529cd2c11e2fbfb919c3d936e3b32af0e92bd710af71a1700776b5e56c99297cfbc3b73ceec'
74139
PORT_FILE = 'emdawnwebgpu_pkg/emdawnwebgpu.port.py'
75140

76141
# Port information (required)
77-
URL = 'https://dawn.googlesource.com/dawn/+/refs/heads/main/src/emdawnwebgpu/'
78-
DESCRIPTION = "Emdawnwebgpu is a fork of Emscripten's original USE_WEBGPU, implementing a newer, more stable version of the standardized webgpu.h interface."
142+
143+
# - Visible in emcc --show-ports and emcc --use-port=emdawnwebgpu:help
79144
LICENSE = "Some files: BSD 3-Clause License. Other files: Emscripten's license (available under both MIT License and University of Illinois/NCSA Open Source License)"
145+
146+
# - Visible in emcc --use-port=emdawnwebgpu:help
147+
DESCRIPTION = "Emdawnwebgpu implements webgpu.h on WebGPU, replacing -sUSE_WEBGPU. **For info on usage and filing feedback, see link below.**"
148+
URL = 'https://dawn.googlesource.com/dawn/+/80062b708e44aa4d8c48e555ed0cc801396069f6/src/emdawnwebgpu/pkg/README.md'

0 commit comments

Comments
 (0)