Skip to content

Commit 43df0ea

Browse files
authored
chore(πŸ™): update the install-dawn script (#274)
1 parent 4c83b4e commit 43df0ea

11 files changed

Lines changed: 265 additions & 81 deletions

File tree

β€Ž.github/actions/setup/action.ymlβ€Ž

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,7 @@ runs:
3131
run: yarn install --immutable
3232
shell: bash
3333

34-
- name: Download Dawn Binary Artifacts
35-
uses: dawidd6/action-download-artifact@v2
36-
with:
37-
workflow: "build-dawn.yml"
38-
repo: wcandillon/react-native-webgpu
39-
github_token: ${{ inputs.github_token }}
40-
path: artifacts
41-
branch: main
42-
name: dawn-libs
43-
44-
- name: Copy Artifacts to libs folder
34+
- name: Install Dawn
4535
working-directory: packages/webgpu
4636
shell: bash
47-
run: yarn copy-artifacts
37+
run: yarn install-dawn

β€Ž.github/workflows/build-dawn.ymlβ€Ž

Lines changed: 0 additions & 45 deletions
This file was deleted.

β€Ž.github/workflows/ci.ymlβ€Ž

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ jobs:
3636
- name: Typecheck files
3737
run: yarn tsc
3838

39-
- name: Codegen
40-
working-directory: packages/webgpu
41-
run: yarn codegen
42-
4339
test:
4440
runs-on: macos-latest
4541
steps:

β€ŽREADME.mdβ€Ž

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -212,27 +212,25 @@ git submodule update --init
212212

213213
Make sure you have all the tools required for building the Skia libraries (Android Studio, XCode, Ninja, CMake, Android NDK/build tools).
214214

215-
### Building Dawn
216-
217-
```sh
218-
yarn
219-
cd packages/webgpu
220-
yarn build-dawn
221-
```
222-
223215
### Downloading Dawn
224216

225217
There is an alternative way which is to download the prebuilt binaries from GitHub.
226-
You need to have the [Github CLI](https://cli.github.com/) installed:
227218

228219
```sh
229220
$ yarn
230221
$ cd packages/webgpu
231-
$ yarn download-artifacts
232-
$ yarn copy-artifacts
222+
$ yarn install-dawn
233223
```
234224

235-
Alternatively you can also download the prebuilt binaries [here](https://github.com/wcandillon/react-native-webgpu/actions/workflows/build-dawn.yml).
225+
### Building Dawn
226+
227+
Alternatively, you can build Dawn locally.
228+
229+
```sh
230+
yarn
231+
cd packages/webgpu
232+
yarn build-dawn
233+
```
236234

237235
### Upgrading
238236

β€Žapps/example/ios/Podfile.lockβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1865,7 +1865,7 @@ PODS:
18651865
- ReactCommon/turbomodule/core
18661866
- SocketRocket
18671867
- Yoga
1868-
- react-native-wgpu (0.2.9):
1868+
- react-native-wgpu (0.2.10):
18691869
- boost
18701870
- DoubleConversion
18711871
- fast_float
@@ -2903,7 +2903,7 @@ SPEC CHECKSUMS:
29032903
React-microtasksnativemodule: 75b6604b667d297292345302cc5bfb6b6aeccc1b
29042904
react-native-safe-area-context: c6e2edd1c1da07bdce287fa9d9e60c5f7b514616
29052905
react-native-skia: 5bf2b2107cd7f2d806fd364f5e16b1c7554ed3cd
2906-
react-native-wgpu: 6b98abaead58c53560720db8074bb82b29edd9a8
2906+
react-native-wgpu: 9c80c820813ecb17fe331794180a00fb21a33af2
29072907
React-NativeModulesApple: 879fbdc5dcff7136abceb7880fe8a2022a1bd7c3
29082908
React-oscompat: 93b5535ea7f7dff46aaee4f78309a70979bdde9d
29092909
React-perflogger: 5536d2df3d18fe0920263466f7b46a56351c0510

β€Žpackages/webgpu/cpp/rnwgpu/api/GPU.hβ€Ž

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
#include "AsyncRunner.h"
1414

15-
#include "dawn/dawn_proc.h"
1615
#include "dawn/native/DawnNative.h"
1716
#include "webgpu/webgpu_cpp.h"
1817

β€Žpackages/webgpu/cpp/rnwgpu/api/GPUCanvasContext.cppβ€Ž

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
#include <memory>
55

66
#ifdef __APPLE__
7-
#include "dawn/native/MetalBackend.h"
7+
namespace dawn::native::metal {
8+
9+
void WaitForCommandsToBeScheduled(WGPUDevice device);
10+
11+
}
812
#endif
913

1014
namespace rnwgpu {

β€Žpackages/webgpu/package.jsonβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"libs/**",
2020
"*.podspec"
2121
],
22+
"dawn": "chromium/7472",
2223
"scripts": {
2324
"test": "NODE_OPTIONS='--experimental-require-module' jest -i",
2425
"test:ref": "REFERENCE=true NODE_OPTIONS='--experimental-require-module' jest -i",
@@ -32,8 +33,7 @@
3233
"clang-format-android": "find android/cpp/ -iname \"*.h\" -o -iname \"*.m\" -o -iname \"*.cpp\" | xargs clang-format -i",
3334
"clang-format-common": "find cpp/rnwgpu -iname \"*.h\" -o -iname \"*.m\" -o -iname \"*.cpp\" | xargs clang-format -i",
3435
"cpplint": "cpplint --linelength=230 --filter=-legal/copyright,-whitespace/indent,-whitespace/comments,-whitespace/ending_newline,-build/include_order,-runtime/references,-readability/todo,-whitespace/blank_line,-whitespace/todo,-runtime/int,-build/c++11,-whitespace/parens --exclude=example --exclude=android/.cxx --exclude=cpp/webgpu --exclude=cpp/dawn --exclude=ios --exclude=android/build --exclude=node_modules --recursive .",
35-
"download-artifacts": "tsx scripts/build/download-artifacts.ts && yarn copy-artifacts",
36-
"copy-artifacts": "tsx scripts/build/copy-artifacts.ts",
36+
"install-dawn": "tsx scripts/install-dawn.ts",
3737
"codegen": "tsx scripts/codegen/codegen.ts && yarn clang-format"
3838
},
3939
"keywords": [

β€Žpackages/webgpu/scripts/build/dawn-configuration.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,5 @@ export const checkBuildArtifacts = () => {
9393
libs.forEach((lib) => {
9494
checkFileExists(`libs/apple/${lib}.xcframework`);
9595
});
96-
checkFileExists("libs/dawn.json");
96+
//checkFileExists("libs/dawn.json");
9797
};

β€Žpackages/webgpu/scripts/codegen/model/dawn.tsβ€Ž

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import _ from "lodash";
22

3+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
4+
// @ts-expect-error
35
import dawn from "../../../libs/dawn.json";
46

57
export const mapKeys = <T extends object>(obj: T) =>
@@ -222,7 +224,8 @@ export const resolveNative = (
222224
if (!hasPropery(object, "methods")) {
223225
return null;
224226
}
225-
return object.methods.find((m) => {
227+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
228+
return (object.methods as any).find((m: any) => {
226229
return _.camelCase(m.name.toLowerCase()) === methodName;
227230
});
228231
};

0 commit comments

Comments
Β (0)