Unity built-in (legacy) renderer:
In the Player Settings you find the “Multithreaded Rendering” and “Graphics Jobs” options. The following text is copied from the documentation, but it sounds very similar to me:
It seems the difference is that Multithreaded Rendering runs on exactly one worker thread, where Graphics Jobs might run on multiple worker threads.
What are the pros and cons of each method? They must have different pros and cons, otherwise more than one option wouldn’t exist.
When would I use MTR over GJ for example?
The MTR and GJ options don’t seem to be exclusive, I can enable just one or both. Which option dominates when I enable both?
Hi!
The options are not mutually exclusive, you can enable both.
Multithreaded rendering: graphics API calls are moved from the main thread to a separate render thread.
Graphics jobs: multiple threads prepare commands for the thread that submits graphics API calls.
If you have both enabled, main thread schedules some work for worker threads, which prepare commands for the render thread, which in turn submits graphics API calls.
If I disable Multithreaded rendering and only enable Graphics jobs, will main thread offload all its works including something like Batch.DrawInstanced to Render Thread?
It depends on what your performance bottleneck is and on the target hardware. If any of those options would’ve been a clear performance benefit in all possible scenarios, there wouldn’t have been an checkbox
My scenario is I found Batch.DrawInstanced run on Main Thread will dispatch Batch.FillInstanceProperties to job worker threads but it will wait for it to finish the job. So the Batch.DrawInstanced will cost much on Main Thread.
I found enable Graphics jobs will dispatch some calls of Batch.DrawInstanced to Render Thread on Editor, but it has no effect on Android with OpenGLES 3.2, so I’m wondering if there is any way to make Render Thread or job worker thread also run some Batch.DrawInstanced to reduce the workload on Main Thread on Android with OpenGLES?
Yes, I always enable multithreaded rendering, but I found the Batch.DrawInstanced on MainThread will wait Batch.FillInstanceProperties which takes a lot of time on MainThread. I found Graphics jobs could move some works to Render Thread but it donesn’t take effect on Android with OpenGLES, so I want to know will Graphics jobs have effect on Android with OpenGLES?
Worth noting, we are now working on a new graphics jobs threading mode which aims to remove unnecessary synchronization between the main thread and graphics jobs threads at the beginning/end of frames. In addition, we are also working to provide official Graphics Jobs support in Editor. We are first targeting DX12, but support for other compatible graphics backends will follow shortly.
Good to know that it’s being worked on. Vulkan support would also be great since it’s cross platform by design (and has issues in 2021 on quest 2 which then could be included)