Skip to content

Commit 09e2f9e

Browse files
committed
Merge branch 'main' into computetoys
2 parents 136cd96 + 69463a1 commit 09e2f9e

98 files changed

Lines changed: 9123 additions & 4546 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-dawn.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,30 @@ jobs:
88
uses: actions/checkout@v2
99
with:
1010
submodules: true
11-
12-
- name: Setup Android NDK
11+
- name: Initialize Dawn's abseil-cpp submodule
12+
run: |
13+
cd externals/dawn
14+
git submodule update --init third_party/abseil-cpp
15+
- name: Install NDK
16+
uses: nttld/setup-ndk@afb4c9964b521afb97c864b7d40b11e6911bd410 # v1.5.0
1317
id: setup-ndk
14-
uses: nttld/setup-ndk@v1
1518
with:
16-
ndk-version: r26d
17-
19+
ndk-version: r27d
1820
- name: Set ANDROID_NDK
1921
run: echo "ANDROID_NDK=$ANDROID_HOME/ndk-bundle" >> $GITHUB_ENV
20-
2122
- name: Setup Ninja
2223
uses: seanmiddleditch/gha-setup-ninja@master
23-
2424
- uses: actions/setup-node@v3
2525
with:
2626
cache: 'yarn'
2727
cache-dependency-path: yarn.lock
28-
2928
- name: Install Package
3029
run: yarn install --frozen-lockfile
31-
3230
- name: Build Dawn
3331
working-directory: packages/webgpu
3432
env:
3533
ANDROID_NDK: ${{ steps.setup-ndk.outputs.ndk-path }}
3634
run: yarn build-dawn
37-
3835
- name: Upload artifacts - Dawn Library Files
3936
if: github.ref == 'refs/heads/main'
4037
uses: actions/upload-artifact@v4

.github/workflows/ci.yml

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,10 @@ jobs:
9898
java-version: '17'
9999

100100
- name: Install NDK
101-
if: env.turbo_cache_hit != 1
102-
uses: nttld/setup-ndk@v1
101+
uses: nttld/setup-ndk@afb4c9964b521afb97c864b7d40b11e6911bd410 # v1.5.0
103102
id: setup-ndk
104103
with:
105-
ndk-version: r26d
104+
ndk-version: r27d
106105

107106
- name: Set ANDROID_NDK
108107
run: echo "ANDROID_NDK=$ANDROID_HOME/ndk-bundle" >> $GITHUB_ENV
@@ -164,36 +163,36 @@ jobs:
164163
- name: Build example for iOS
165164
run: |
166165
yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"
167-
168-
build-macos:
169-
runs-on: macos-latest
170-
env:
171-
TURBO_CACHE_DIR: .turbo/macos
172-
steps:
173-
- name: Checkout
174-
uses: actions/checkout@v3
175-
176-
- name: Setup
177-
uses: ./.github/actions/setup
178-
with:
179-
github_token: ${{ secrets.GITHUB_TOKEN }}
180-
181-
- name: Cache turborepo for macOS
182-
uses: actions/cache@v3
183-
with:
184-
path: ${{ env.TURBO_CACHE_DIR }}
185-
key: ${{ runner.os }}-turborepo-macos-${{ hashFiles('yarn.lock') }}
186-
restore-keys: |
187-
${{ runner.os }}-turborepo-macos-
188-
189-
- name: Check turborepo cache for macOS
190-
run: |
191-
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:macos --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:macos').cache.status")
192-
193-
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
194-
echo "turbo_cache_hit=1" >> $GITHUB_ENV
195-
fi
196-
197-
- name: Build example for macOS
198-
run: |
199-
yarn turbo run build:macos --cache-dir="${{ env.TURBO_CACHE_DIR }}"
166+
# We disable it until RNTA support 0.81
167+
# build-macos:
168+
# runs-on: macos-latest
169+
# env:
170+
# TURBO_CACHE_DIR: .turbo/macos
171+
# steps:
172+
# - name: Checkout
173+
# uses: actions/checkout@v3
174+
175+
# - name: Setup
176+
# uses: ./.github/actions/setup
177+
# with:
178+
# github_token: ${{ secrets.GITHUB_TOKEN }}
179+
180+
# - name: Cache turborepo for macOS
181+
# uses: actions/cache@v3
182+
# with:
183+
# path: ${{ env.TURBO_CACHE_DIR }}
184+
# key: ${{ runner.os }}-turborepo-macos-${{ hashFiles('yarn.lock') }}
185+
# restore-keys: |
186+
# ${{ runner.os }}-turborepo-macos-
187+
188+
# - name: Check turborepo cache for macOS
189+
# run: |
190+
# TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:macos --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:macos').cache.status")
191+
192+
# if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
193+
# echo "turbo_cache_hit=1" >> $GITHUB_ENV
194+
# fi
195+
196+
# - name: Build example for macOS
197+
# run: |
198+
# yarn turbo run build:macos --cache-dir="${{ env.TURBO_CACHE_DIR }}"

.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/6793
4+
branch = chromium/7403

README.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,18 @@ Below are some examples from the [example app](/apps/example/).
1515

1616
https://github.com/user-attachments/assets/116a41b2-2cf8-49f1-9f16-a5c83637c198
1717

18+
## Three.js
19+
1820
Starting from `r168`, Three.js runs out of the box with React Native WebGPU.
1921
You need to have a slight modification of [the metro config](/apps/example/metro.config.js) to resolve Three.js to the WebGPU build.
2022
We also support [three-fiber](/apps/example/src/ThreeJS/Fiber.tsx).
21-
For model loading, we also need [the following polyfill](/apps/example/src/App.tsx#29).
23+
For model loading, we also need the following polyfill:
24+
25+
```tsx
26+
// The two lines below are needed by three.js
27+
import "fast-text-encoding";
28+
window.parent = window;
29+
```
2230

2331
https://github.com/user-attachments/assets/5b49ef63-0a3c-4679-aeb5-e4b4dddfcc1d
2432

@@ -190,7 +198,7 @@ device.queue.copyExternalImageToTexture(
190198
### iOS
191199

192200
To run the React Native WebGPU project on the iOS simulator, you need to disable the Metal validation API.
193-
In "Edit Scheme," uncheck "Metal Validation."
201+
In "Edit Scheme," uncheck "Metal Validation". Learn more [here](https://developer.apple.com/documentation/xcode/validating-your-apps-metal-api-usage/).
194202

195203
<img width="1052" alt="Uncheck 'Metal Validation'" src="https://github.com/user-attachments/assets/2676e5cc-e351-4a97-bdc8-22cbd7df2ef2">
196204

@@ -212,16 +220,6 @@ cd packages/webgpu
212220
yarn build-dawn
213221
```
214222

215-
You can also filter the platforms to build, for instance to skip the macOS and visionOS build:
216-
```sh
217-
yarn build-dawn --exclude=xros,xrsimulator,macosx
218-
```
219-
220-
Alternatively if you want to build for a specific platform only, you can use `includeOnly`.
221-
```sh
222-
yarn build-dawn --includeOnly=xros,xrsimulator
223-
```
224-
225223
### Downloading Dawn
226224

227225
There is an alternative way which is to download the prebuilt binaries from GitHub.

apps/example/.eslintrc

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

apps/example/android/build.gradle

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,7 @@ allprojects {
2626
repositories {
2727
maven {
2828
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
29-
url({
30-
def searchDir = rootDir.toPath()
31-
do {
32-
def p = searchDir.resolve("node_modules/react-native/android")
33-
if (p.toFile().exists()) {
34-
return p.toRealPath().toString()
35-
}
36-
} while (searchDir = searchDir.getParent())
37-
throw new GradleException("Could not find `react-native`")
38-
}())
29+
url("${findNodeModulesPath("react-native", rootDir)}/android")
3930
}
4031
mavenCentral()
4132
google()

apps/example/android/gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ android.jetifier.ignorelist=hermes-android,react-android
3333
# You can also override it from the CLI using
3434
# ./gradlew <task> -PreactNativeArchitectures=x86_64
3535
reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
36-
newArchEnabled=false
36+
newArchEnabled=true
3737
hermesEnabled=true
3838

3939
# Use this property to enable support to the new architecture.
@@ -43,7 +43,7 @@ hermesEnabled=true
4343
# are providing them.
4444
# Note that this is incompatible with web debugging.
4545
#newArchEnabled=true
46-
#bridgelessEnabled=true
46+
bridgelessEnabled=true
4747

4848
# Uncomment the line below to build React Native from source.
4949
#react.buildFromSource=true

apps/example/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

apps/example/app.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
],
1212
"resources": {
1313
"android": [
14-
"dist/res",
15-
"dist/main.android.jsbundle"
14+
"dist/res"
1615
],
1716
"ios": [
1817
"dist/assets",

apps/example/eslint.config.mjs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// eslint.config.js
2+
import wcandillon from "eslint-config-react-native-wcandillon";
3+
4+
export default [
5+
{
6+
ignores: ["**/*/components/meshes", "**/Pods/**", "node_modules/**", "dist/**", "android/**", "ios/**", "macos/**", "*.config.js"]
7+
},
8+
...wcandillon,
9+
{
10+
files: ["**/*.{js,jsx,ts,tsx}"],
11+
languageOptions: {
12+
parserOptions: {
13+
ecmaVersion: "latest",
14+
sourceType: "module"
15+
}
16+
},
17+
rules: {
18+
"no-bitwise": "off",
19+
"@typescript-eslint/no-require-imports": "off",
20+
"import/extensions": "off",
21+
"prettier/prettier": [
22+
"error",
23+
{
24+
"trailingComma": "all"
25+
}
26+
]
27+
}
28+
}
29+
];

0 commit comments

Comments
 (0)