Wondering performance / hardware limits on # of compute shaders


I have several mesh instances managed by 1/2 compute shaders. I am thinking to do a clean up / refactoring so that each mesh type is associated with its own compute shader. Also I need to do it because I was hit by the 8 storage buffer limit in a compute shader.

This will mean that I will have a BABYLON.ComputeShader instance for each mesh. I expect 30-50 compute shader instances created and executing dispatch call at each rendering frame. I imagine I will have a generic compute shader template. Each mesh might add different customized sections to the template when creating compute shader instance. Something BJS CustomShader. I would like to know if there is any performance / hardware limitation on the # of compute shader instances I can create?

1 Like

Compute shaders are quite light on resources on the javascript side, so you can use quite a bit (the Ocean demo does around 200-220 dispatches per frame). You may be limited by the GPU, though, if you are doing heavy processing in the shaders.