|
3 | 3 | # University of Illinois/NCSA Open Source License. Both these licenses can be
|
4 | 4 | # found in the LICENSE file.
|
5 | 5 |
|
| 6 | +# https://dawn.googlesource.com/dawn/+/80062b708e44aa4d8c48e555ed0cc801396069f6/src/emdawnwebgpu/pkg/README.md |
6 | 7 | r"""
|
| 8 | +The full README of Emdawnwebgpu follows. |
| 9 | +
|
7 | 10 | # Emdawnwebgpu
|
8 | 11 |
|
9 | 12 | Emdawnwebgpu is Dawn's implementation of webgpu.h for Emscripten (on top of the
|
10 | 13 | WebGPU JS API). It is a fork of Emscripten's original `USE_WEBGPU` bindings,
|
11 | 14 | and while it is maintained in Dawn, it works in any browser supporting WebGPU
|
12 | 15 | (modulo individual feature support).
|
13 | 16 |
|
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: |
16 | 51 |
|
17 |
| -Find new versions of this package at <https://github.com/google/dawn/releases>. |
| 52 | + --use-port=emdawnwebgpu |
18 | 53 |
|
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 |
21 | 55 |
|
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+.** |
23 | 59 |
|
24 |
| -First, start with either: |
| 60 | +Download and extract the `emdawnwebgpu-*.remoteport.py` file from |
| 61 | +<https://github.com/google/dawn/releases>. |
25 | 62 |
|
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: |
29 | 64 |
|
30 |
| -## How to use this package (local or remote) |
| 65 | + --use-port=path/to/emdawnwebgpu_remoteport_file.py |
31 | 66 |
|
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 |
34 | 68 |
|
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.** |
36 | 73 |
|
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: |
38 | 84 |
|
39 | 85 | --closure-args=--externs=path/to/emdawnwebgpu_pkg/webgpu/src/webgpu-externs.js
|
40 | 86 |
|
| 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 | +
|
41 | 105 | ## Port options
|
42 | 106 |
|
43 | 107 | Options can be set by appending `:key1=value:key2=value` to `--use-port`.
|
44 | 108 | For information about port options, run:
|
45 | 109 |
|
46 | 110 | 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 |
49 | 113 |
|
50 | 114 | ### C++ bindings
|
51 | 115 |
|
|
55 | 119 | `webgpu_cpp.h`, etc.), you can set the option `cpp_bindings=false`:
|
56 | 120 |
|
57 | 121 | --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 |
60 | 124 |
|
61 | 125 | ## Embuilder
|
62 | 126 |
|
63 | 127 | If your build process needs a separate step to build the port before linking,
|
64 | 128 | use Emscripten's `embuilder`.
|
65 | 129 |
|
66 | 130 | 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). |
68 | 133 | """
|
69 | 134 |
|
70 |
| -TAG = 'v20250531.224602' |
| 135 | +TAG = 'v20250807.221415' |
71 | 136 |
|
72 | 137 | EXTERNAL_PORT = f'https://github.com/google/dawn/releases/download/{TAG}/emdawnwebgpu_pkg-{TAG}.zip'
|
73 |
| -SHA512 = 'e3db5b2a4cc97cbb9b8a0c1f6fe7a740bf644322dfa4641a7b0902c192c58205d76acb9b359a0d6da1fdc9795e85eb1cf1927aa47f2a82814ee29868fef6670e' |
| 138 | +SHA512 = 'ab9f3af2536ef3a29c20bb9c69f45b5ee512b8e33fb559f8d0bf4529cd2c11e2fbfb919c3d936e3b32af0e92bd710af71a1700776b5e56c99297cfbc3b73ceec' |
74 | 139 | PORT_FILE = 'emdawnwebgpu_pkg/emdawnwebgpu.port.py'
|
75 | 140 |
|
76 | 141 | # 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 |
79 | 144 | 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