Babylon React Native Compute Shaders

I am very much looking forward to compute shaders in React Native apps. The current version of Babylon React Native is still using WebGL, which means that it is not yet possible to use this package to run compute shaders. I was wondering if anyone knows if this is on the roadmap?

cc @bghgary

1 Like

Babylon React Native does not use WebGL underneath. It is however using GLSL. The compute extension for WebGL2 has been halted in favor of WebGPU. Given that, the best way to get compute shader support in Babylon (React) Native would be to support WebGPU way of doing compute shaders. I unfortunately don’t know how that works. @Evgeni_Popov Any thoughts?

1 Like

Support for compute shaders in WebGPU is done using WGSL:

I’m not sure WGSL could be translated to some other languages on native side(?)

We could use some other languages than WGSL, though, with minor changes to Compute/computeShader and Compute/computeEffect (ComputeEffect assumes the language is WGSL).

Then, a number of methods have to be implemented by the engine:

The modeling was done on the basis of WebGPU, maybe it will need some adjustments if compute shaders work differently in other environments.

2 Likes

I guess you would need tint to convert to your native platform of choice.

2 Likes

To answer this question explicitly, no, this is not on the roadmap at the moment. WebGPU is still relatively new and getting compute shaders working in native will take some work. Feel free to file a feature request in the BabylonNative repo in case others are interested.

3 Likes