I’m using WebGPUEngine,When i switch to the Engine API, slow tasks disappear… Why is that?
but i want use WebGPUEngine.
I’m using WebGPUEngine,When i switch to the Engine API, slow tasks disappear… Why is that?
but i want use WebGPUEngine.
Ah, that’s why, the compilation is currently synchronous in WebGPU.
So there’s nothing we can do about it at the moment - shaders can take a while to compile.
However, there are plans to implement asynchronous shader compilation for WebGPU.
Thank you for your reply. Where can you see these plans?
There are public issues here: Issues · BabylonJS/Babylon.js · GitHub
We also have our own internal issue repository that people don’t have access to.
@Evgeni_Popov Is there any way to get shader code to compile ahead of time? Will this save compilation time when add new mesh?
Because I found that the only time a large number of shader compilation steps occurred was when a new mesh was added.
You can call mat.forceCompilation(mesh)
for the mesh(es) that will use the material mat
, to force creating the effect ahead of time, and not when the mesh is first displayed.
If you are loading glTF, you can also set compileMaterials to true which will call forceCompilation
on all the various possible mesh/options combinations before returning.