How to warmup shaders multi-thread?

How to use ShaderWarmup.WarmupShaderFromCollection to warm up shaders correctly? Is this method support multi-thread as the document says? Is this “multi-thread” handled by Unity or do we need to write a job to make it work on multi-thread?

If it’s supported, Unity will warm up variants using multiple threads automatically.

Does that mean that when I use the API above and the device support it, Unity will warm up the corresponding shader variants in multiple worker threads, and in the meanwhile, the main thread will not be blocked ?

No, this is not an async call. But it may use multiple threads to complete the work in parallel.


Thx, but I am not sure if I understood it correctly: In the profile I applied, does the “multi-thread” actually means the “create PSO jobs” are scheduled with multiple thread, and what you mean about “not async” is that the "CreateGPUprogram"actions are still happened on the main thread ?

When you call ShaderWarmup.WarmupShaderFromCollection, it will use (if it can) multiple threads to complete the needed work. This work includes PSO creation.
The function itself is executed synchronously. This means no other work will happen until it’s finished - it will wait till all the required work has been completed.