React Native WebGPU implementation (with gfx-rs/wgpu)
Right now due to lack of XCFramework setup library works only on iOS simulator. This should be solved soon since there is a clear path to make it work.
Download latest wgpu-native release from wgpu-native releases page. Choose wgpu-ios-aarch64-simulator-release build and unzip it into wgpu-native/ directory of this repository.
Create wgpu-native/android directory. Download releases:
wgpu-android-aarch64-release.zipwgpu-android-armv7-release.zipwgpu-android-i686-release.zipwgpu-android-x86_64-release.zip
Unpack them and create the following structure:
wgpu-native/android/lib/x86_64- putlibwgpu_native.afromwgpu-android-x86_64-release.zipinsidewgpu-native/android/lib/x86- putlibwgpu_native.afromwgpu-android-i686-release.zipinsidewgpu-native/android/lib/armeabi-v7a- putlibwgpu_native.afromwgpu-android-armv7-release.zipinsidewgpu-native/android/lib/arm64-v8a- putlibwgpu_native.afromwgpu-android-aarch64-release.zipinside
Get include/ directory from any of the releases and put it into wgpu-native/android/include directory.
Your directory tree should look like this:
android
├───include
│ └───webgpu
│ webgpu.h
│ wgpu.h
│
└───lib
├───arm64-v8a
│ libwgpu_native.a
│
├───armeabi-v7a
│ libwgpu_native.a
│
├───x86
│ libwgpu_native.a
│
└───x86_64
libwgpu_native.a
This process will be automated in future releases.
Install dependencies:
yarn install
Run Nitro codegen:
yarn nitrogen && cd example/ios && pod install && cd ../..
And run example app on simulator:
yarn example ios
Package is not published yet.
import { Instance } from 'react-native-webgpu-rs';
const adapter = await Instance.requestAdapter();
// The rest follows WebGPU spec.See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
Made with create-react-native-library