Skip to content

Commit 4ae93a0

Browse files
authored
fix(⬆️): upgrade Dawn version to chrome/m150 (#436)
1 parent bc83857 commit 4ae93a0

6 files changed

Lines changed: 42 additions & 27 deletions

File tree

.github/workflows/build-dawn.yml

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,39 @@ jobs:
1818
- name: Checkout repository
1919
uses: actions/checkout@v6.0.2
2020

21-
- name: Determine Dawn branch metadata
21+
- name: Determine Dawn version metadata
2222
id: dawn_meta
2323
run: |
2424
set -eo pipefail
25-
branch=$(git config -f .gitmodules submodule.externals/dawn.branch)
26-
if [ -z "$branch" ]; then
27-
echo "Could not determine Dawn branch from .gitmodules" >&2
25+
version=$(node -p "require('./packages/webgpu/package.json').dawn")
26+
commit=$(node -p "require('./packages/webgpu/package.json').dawnCommit")
27+
if [ -z "$version" ] || [ "$version" = "undefined" ]; then
28+
echo "Could not determine Dawn version from package.json ('dawn' field)" >&2
2829
exit 1
2930
fi
30-
slug=${branch//\//-}
31-
echo "branch=$branch" >> "$GITHUB_OUTPUT"
31+
if [ -z "$commit" ] || [ "$commit" = "undefined" ]; then
32+
echo "Could not determine Dawn commit from package.json ('dawnCommit' field)" >&2
33+
exit 1
34+
fi
35+
gitlink=$(git ls-tree HEAD externals/dawn | awk '{print $3}')
36+
if [ "$gitlink" != "$commit" ]; then
37+
echo "Submodule gitlink ($gitlink) does not match package.json dawnCommit ($commit)." >&2
38+
echo "Update the externals/dawn submodule and the dawnCommit field together." >&2
39+
exit 1
40+
fi
41+
slug=${version//\//-}
42+
echo "branch=$version" >> "$GITHUB_OUTPUT"
3243
echo "branch_slug=$slug" >> "$GITHUB_OUTPUT"
3344
3445
- name: Compute release metadata
3546
id: release_meta
3647
run: |
37-
tag="dawn-${DAWN_BRANCH_SLUG}"
48+
tag="dawn-${DAWN_VERSION_SLUG}"
3849
echo "tag_name=$tag" >> "$GITHUB_OUTPUT"
39-
echo "release_name=Dawn ${DAWN_BRANCH}" >> "$GITHUB_OUTPUT"
50+
echo "release_name=Dawn ${DAWN_VERSION}" >> "$GITHUB_OUTPUT"
4051
env:
41-
DAWN_BRANCH: ${{ steps.dawn_meta.outputs.branch }}
42-
DAWN_BRANCH_SLUG: ${{ steps.dawn_meta.outputs.branch_slug }}
52+
DAWN_VERSION: ${{ steps.dawn_meta.outputs.branch }}
53+
DAWN_VERSION_SLUG: ${{ steps.dawn_meta.outputs.branch_slug }}
4354

4455
- name: Create GitHub release
4556
id: create_release
@@ -49,7 +60,7 @@ jobs:
4960
with:
5061
tag_name: ${{ steps.release_meta.outputs.tag_name }}
5162
name: ${{ steps.release_meta.outputs.release_name }}
52-
body: "Dawn prebuilt binaries for version ${{ steps.dawn_meta.outputs.branch }}"
63+
body: "Dawn prebuilt binaries for ${{ steps.dawn_meta.outputs.branch }} (Dawn commit pinned in package.json dawnCommit)"
5364
draft: false
5465
prerelease: true
5566
generate_release_notes: false

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[submodule "externals/dawn"]
22
path = externals/dawn
33
url = https://dawn.googlesource.com/dawn
4-
branch = chromium/7849
4+
branch = main

externals/dawn

Submodule dawn updated from cbfe412 to 63f25fe

packages/webgpu/CONTRIBUTING.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,31 @@ The Expo config plugin lives in `plugin/src` and is compiled to `plugin/build` b
2323

2424
## Upgrading Dawn
2525

26-
The Dawn version is pinned in two places that must stay in sync:
26+
The Dawn version tracks the one shipped by `@shopify/react-native-skia` Graphite builds: the pin is the exact Dawn commit from the Skia milestone's DEPS file (`third_party/externals/dawn` in Skia's DEPS). It is recorded in two places that must stay in sync:
2727

28-
- `.gitmodules``submodule.externals/dawn.branch` (e.g. `chromium/7849`)
29-
- `packages/webgpu/package.json`the `"dawn"` field (same value, e.g. `chromium/7849`)
28+
- the `externals/dawn` submodule gitlink (the commit the submodule points at)
29+
- `packages/webgpu/package.json``"dawn"` (a human-readable label, e.g. `chrome-m150`; Skia milestones mirror Chrome milestones) and `"dawnCommit"` (the exact commit hash)
3030

31-
`yarn install-dawn` downloads **prebuilt** binaries from a GitHub release tagged `dawn-<branch-slug>` (e.g. `dawn-chromium-7849`); the release host is configured at the top of `scripts/install-dawn.ts`. `yarn build-dawn` builds the same binaries from the submodule source instead.
31+
The **Build Dawn** workflow verifies the gitlink matches `dawnCommit` and fails otherwise.
3232

33-
Steps to bump to a new Dawn version (`chromium/<N>`):
33+
`yarn install-dawn` downloads **prebuilt** binaries from a GitHub release on this repo tagged `dawn-<version-slug>` (e.g. `dawn-chrome-m150`). `yarn build-dawn` builds the same binaries from the submodule source instead.
3434

35-
1. **Point the submodule at the new branch.** Update both `.gitmodules` and the `"dawn"` field in `package.json` to `chromium/<N>`, then move the submodule to the new tip:
35+
Steps to bump to a new Dawn version (new Skia milestone `m<N>`):
36+
37+
1. **Find the Dawn commit** in the Skia milestone's `DEPS` file (`third_party/externals/dawn` entry).
38+
39+
2. **Point the submodule at that commit** and update `package.json` (`"dawn": "chrome-m<N>"`, `"dawnCommit": "<hash>"`):
3640

3741
```sh
38-
git submodule set-branch --branch chromium/<N> externals/dawn
39-
git submodule update --remote externals/dawn
42+
cd externals/dawn && git fetch origin && git checkout <hash> && cd ../..
4043
```
4144

42-
2. **Publish prebuilt binaries.** Trigger the **Build Dawn** workflow (`.github/workflows/build-dawn.yml`, `workflow_dispatch`). It reads the branch from `.gitmodules`, builds Android + Apple, and creates the `dawn-chromium-<N>` release with the headers, the Android `.so`s, and the Apple `.xcframework`. (To build locally instead, run `yarn build-dawn`; this requires the Android NDK and Xcode toolchains.)
45+
3. **Publish prebuilt binaries.** Trigger the **Build Dawn** workflow (`.github/workflows/build-dawn.yml`, `workflow_dispatch`). It builds Android + Apple from the submodule and creates the `dawn-chrome-m<N>` release with the headers, the Android `.so`s, and the Apple `.xcframework`. (To build locally instead, run `yarn build-dawn`; this requires the Android NDK and Xcode toolchains.)
4346

44-
3. **Pull the new binaries** once the release exists:
47+
4. **Pull the new binaries** once the release exists:
4548

4649
```sh
4750
cd packages/webgpu && yarn install-dawn
4851
```
4952

50-
4. **Verify and commit.** Build and run the example app, then commit the submodule bump together with the updated `.gitmodules` and `package.json`.
53+
5. **Verify and commit.** Build and run the example app, then commit the submodule bump together with the updated `package.json`.

packages/webgpu/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"app.plugin.js",
2323
"plugin/build/**"
2424
],
25-
"dawn": "chromium/7849",
25+
"dawn": "chrome-m150",
26+
"dawnCommit": "63f25feec51e9351fb25222b6d5de1af791d7c4f",
2627
"scripts": {
2728
"test": "NODE_OPTIONS='--experimental-require-module' jest -i",
2829
"test:ref": "REFERENCE=true NODE_OPTIONS='--experimental-require-module' jest -i",

packages/webgpu/scripts/install-dawn.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ if (!dawnVersion) {
7575
}
7676

7777
// Parse the dawn version to construct the release tag
78-
// Format: "chromium/7472" -> "dawn-chromium-7472"
78+
// Format: "chrome-m150" -> "dawn-chrome-m150"
7979
const releaseTag = `dawn-${dawnVersion.replace("/", "-")}`;
8080
const releaseUrl = `https://github.com/wcandillon/react-native-webgpu/releases/tag/${releaseTag}`;
8181

@@ -171,7 +171,7 @@ const assetNames: { [key: string]: string } = {
171171
};
172172

173173
for (const [index, asset] of assets.entries()) {
174-
const assetUrl = `https://github.com/Shopify/react-native-skia/releases/download/${releaseTag}/${asset.name}`;
174+
const assetUrl = `https://github.com/wcandillon/react-native-webgpu/releases/download/${releaseTag}/${asset.name}`;
175175
const tarPath = join(libsDir, asset.name);
176176
const displayName = assetNames[asset.name] || asset.name;
177177

0 commit comments

Comments
 (0)