[WebGPU] Can we decouple compute and graphics pipelines?

Is it possible to have the compute pipeline running concurrently and independently from the graphics one, and to pull results from compute shaders at specific time interval to update the scene?

To be more specific, currently I have a PDE solver implemented in compute shaders, and each update call is basically advancing the solver in time to get a new solution at the new time-step. Currently I am doing an update call every frame with onBeforeRenderObservable.add(), for example as follows:

scene.onBeforeRenderObservable.add(() => {

The issue is that if the dispatch of the compute shader takes time, it will freeze the 3D visualization and kill the FPS. Can I have the compute pipeline running independently, with its own time-stepping and with compute shaders that could take many seconds to execute, and only query the buffers from the scene at controlled time intervals instead of calling an update() every frame?

The goal is to keep 60 FPS by only updating the scene when needed. For example let’s say that I am computing a new solution from my solver in a compute shader, I would like to be able to continue to visualize and interact with the graphics while waiting for the compute to complete and update with new data.

Thanks if you understood my question and if someone can point me to an idea of solution :smiley:

cc @Evgeni_Popov

It would be great if you can provide a playground so that we can more easily help with the code.

I don’t think you can restrict a compute shader to using a subset of GPU resources (or perhaps use small X/Y dimensions for the size of the workgroup to avoid maximizing GPU usage?), but I’m not an expert in this area.

You should probably ask your question in the WebGPU channel of the Matrix chat (https://app.element.io/#/room/#WebGPU:matrix.org), but without reference to Babylon.js, as the people there may not be familiar with Babylon.js, and your question is a general compute question anyway.

Ok thanks for the answer. Yes such idea is probably out of scope of Babylon and would require going to a lower-level to develop custom pipelines.