From 1481bb9cb5f3dcd58932934424430e5dab81c1f7 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Sun, 1 Sep 2024 04:12:01 +0200 Subject: [PATCH] Fix regressions (#94) --- apps/paper/ios/Podfile.lock | 6 +++--- packages/webgpu/package.json | 4 ++-- packages/webgpu/react-native-wgpu.podspec | 4 ++++ packages/webgpu/scripts/build/dawn.ts | 6 +++++- packages/webgpu/scripts/build/ios.toolchain.cmake | 2 +- packages/webgpu/src/__tests__/setup.ts | 13 ++++++++----- 6 files changed, 23 insertions(+), 12 deletions(-) diff --git a/apps/paper/ios/Podfile.lock b/apps/paper/ios/Podfile.lock index 78f381871..71d41944e 100644 --- a/apps/paper/ios/Podfile.lock +++ b/apps/paper/ios/Podfile.lock @@ -960,7 +960,7 @@ PODS: - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - Yoga - - react-native-wgpu (0.1.3): + - react-native-wgpu (0.1.5): - DoubleConversion - glog - hermes-engine @@ -1545,7 +1545,7 @@ SPEC CHECKSUMS: React-Mapbuffer: bf56147c9775491e53122a94c423ac201417e326 react-native-safe-area-context: ab8f4a3d8180913bd78ae75dd599c94cce3d5e9a react-native-skia: 8da84ea9410504bf27f0db229539a43f6caabb6a - react-native-wgpu: 220ca988d2907efab8b1111f81682d9af957a98d + react-native-wgpu: a7cafd1960f61fa2fca1ddd478553f0950052f0a React-nativeconfig: 9f223cd321823afdecf59ed00861ab2d69ee0fc1 React-NativeModulesApple: ff7efaff7098639db5631236cfd91d60abff04c0 React-perflogger: 32ed45d9cee02cf6639acae34251590dccd30994 @@ -1573,7 +1573,7 @@ SPEC CHECKSUMS: RNReanimated: abb16e70ea4fbd72c667946caa3abd0f962897f6 RNScreens: aa943ad421c3ced3ef5a47ede02b0cbfc43a012e SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d - Yoga: 2f71ecf38d934aecb366e686278102a51679c308 + Yoga: ae3c32c514802d30f687a04a6a35b348506d411f PODFILE CHECKSUM: 6a64c4e2f4165ecd7371d7daca36d1c129d3e06d diff --git a/packages/webgpu/package.json b/packages/webgpu/package.json index 5ec7b76c8..268f75369 100644 --- a/packages/webgpu/package.json +++ b/packages/webgpu/package.json @@ -1,6 +1,6 @@ { "name": "react-native-wgpu", - "version": "0.1.4", + "version": "0.1.5", "description": "React Native WebGPU", "main": "lib/commonjs/index", "module": "lib/module/index", @@ -34,7 +34,7 @@ "lint": "eslint . --ext .ts,.tsx --max-warnings 0 --cache --fix", "prepare": "bob build", "build-dawn": "ts-node scripts/build/dawn.ts", - "clean-dawn": "rimraf ./libs && rimraf ../externals/dawn/out", + "clean-dawn": "rimraf ./libs && rimraf ../../externals/dawn/out", "clang-format": "yarn clang-format-ios && yarn clang-format-android && yarn clang-format-common", "clang-format-ios": "find ios/ -iname \"*.h\" -o -iname \"*.mm\" -o -iname \"*.cpp\" | xargs clang-format -i", "clang-format-android": "find android/cpp/ -iname \"*.h\" -o -iname \"*.m\" -o -iname \"*.cpp\" | xargs clang-format -i", diff --git a/packages/webgpu/react-native-wgpu.podspec b/packages/webgpu/react-native-wgpu.podspec index c21980db4..b86b6ed62 100644 --- a/packages/webgpu/react-native-wgpu.podspec +++ b/packages/webgpu/react-native-wgpu.podspec @@ -23,6 +23,10 @@ Pod::Spec.new do |s| 'libs/ios/libwebgpu_dawn.xcframework', ] + s.visionos.vendored_frameworks = [ + 'libs/ios/libwebgpu_dawn_visionos.xcframework', + ] + s.pod_target_xcconfig = { 'HEADER_SEARCH_PATHS' => '$(PODS_TARGET_SRCROOT)/cpp', } diff --git a/packages/webgpu/scripts/build/dawn.ts b/packages/webgpu/scripts/build/dawn.ts index c15a7874c..e34f1e356 100644 --- a/packages/webgpu/scripts/build/dawn.ts +++ b/packages/webgpu/scripts/build/dawn.ts @@ -120,9 +120,13 @@ const ios = { "xcodebuild -create-xcframework " + `-library ${projectRoot}/libs/ios/${lib}.a ` + `-library ${projectRoot}/libs/ios/arm64_iphoneos/${lib}.a ` + + ` -output ${projectRoot}/libs/ios/${lib}.xcframework `, + ); + $( + "xcodebuild -create-xcframework " + `-library ${projectRoot}/libs/ios/${lib}_visionos.a ` + `-library ${projectRoot}/libs/ios/arm64_xros/${lib}.a ` + - ` -output ${projectRoot}/libs/ios/${lib}.xcframework `, + ` -output ${projectRoot}/libs/ios/${lib}_visionos.xcframework `, ); }); diff --git a/packages/webgpu/scripts/build/ios.toolchain.cmake b/packages/webgpu/scripts/build/ios.toolchain.cmake index 7c4917091..382d870fe 100644 --- a/packages/webgpu/scripts/build/ios.toolchain.cmake +++ b/packages/webgpu/scripts/build/ios.toolchain.cmake @@ -166,7 +166,7 @@ list(APPEND _supported_platforms "TVOS" "TVOSCOMBINED" "SIMULATOR_TVOS" "SIMULATORARM64_TVOS" "WATCHOS" "WATCHOSCOMBINED" "SIMULATOR_WATCHOS" "SIMULATORARM64_WATCHOS" "MAC" "MAC_ARM64" "MAC_UNIVERSAL" - "VISIONOS" "SIMULATOR_VISIONOS" "VISIONOSCOMBINED", "SIMULATOR64_VISIONOS" + "VISIONOS" "SIMULATOR_VISIONOS" "VISIONOSCOMBINED" "SIMULATOR64_VISIONOS" "MAC_CATALYST" "MAC_CATALYST_ARM64") # Cache what generator is used diff --git a/packages/webgpu/src/__tests__/setup.ts b/packages/webgpu/src/__tests__/setup.ts index 76fc6cdda..2a9b28e13 100644 --- a/packages/webgpu/src/__tests__/setup.ts +++ b/packages/webgpu/src/__tests__/setup.ts @@ -137,12 +137,15 @@ class ReferenceTestingClient implements TestingClient { if (!this.page) { throw new Error("RemoteSurface not initialized"); } - const fTexturePath = path.join(__dirname, "../../example/src/assets/f.png"); + const fTexturePath = path.join( + __dirname, + "../../../../apps/paper/src/assets/f.png", + ); const fTextureData = fs.readFileSync(fTexturePath); const fTextureBase64 = `data:image/png;base64,${fTextureData.toString("base64")}`; const source = `(async function Main(){ var global = window; - const r = () => {${fs.readFileSync(path.join(__dirname, "../../node_modules/wgpu-matrix/dist/3.x/wgpu-matrix.js"), "utf8")} }; + const r = () => {${fs.readFileSync(path.join(__dirname, "../../../../node_modules/wgpu-matrix/dist/3.x/wgpu-matrix.js"), "utf8")} }; r(); const { mat4, vec3, mat3 } = window.wgpuMatrix; const { device, adapter, gpu, cubeVertexArray, triangleVertWGSL, redFragWGSL, di3D, saturn, moon } = window; @@ -231,13 +234,13 @@ class ReferenceTestingClient implements TestingClient { .catch((e) => console.log(e)); await page.waitForNetworkIdle(); const di3D = decodeImage( - path.join(__dirname, "../../example/src/assets/Di-3d.png"), + path.join(__dirname, "../../../../apps/paper/src/assets/Di-3d.png"), ); const moon = decodeImage( - path.join(__dirname, "../../example/src/assets/moon.png"), + path.join(__dirname, "../../../../apps/paper/src/assets/moon.png"), ); const saturn = decodeImage( - path.join(__dirname, "../../example/src/assets/saturn.png"), + path.join(__dirname, "../../../../apps/paper/src/assets/saturn.png"), ); await page.evaluate( `