This package allows you to use GPU.js with Expo to get a native GPGPU.
- Setup Expo - https://docs.expo.io/versions/latest/introduction/installation/
- Add the following to use
@gpujs/expo-gl
:
import { GLView } from 'expo-gl';
import { GPU } from '@gpujs/expo-gl';
GLView.createContextAsync()
.then(context => {
const gpu = new GPU({ context });
const kernel = gpu.createKernel(kernelFunctionHere, kernelOptionsHere);
kernel();
});
- Visit https://github.com/gpujs/gpu.js for documentation on
kernelFunctionHere
,kernelOptionsHere
, as well as the api. - Run your expo from Android or iOS and have native GPGPU support!
- Have fun!
import { GLView } from 'expo-gl';
import { GPU } from '@gpujs/expo-gl';
GLView.createContextAsync()
.then(context => {
const gpu = new GPU({ context });
const kernel = gpu.createKernel(function() {
return 1;
}, { output: [1], debug: true });
console.log(kernel());
gpu.destroy();
});