I'm just enabled some shadows casters in the scene and I notice that the main thread time for a single spot-light is ridiculously large. What can I do to make this run faster? Currently drawing 4 shadow casters takes like 6ms of main thread time. This is captured in editor but I'd imagine it's not supposed to be this slow anyway since it makes playing in editor with shadows on pretty much impossible.
#Optimize shadow casting
1 messages · Page 1 of 1 (latest)
You can get more information if you use the frame debugger. Make sure you only have the game view visible in the editor.
Also you might get more help if you post in the #archived-hdrp category since this is the Data Oriented Technology Stack forum category ^^
What information would I be looking for in the frame debugger? This is main thread preparing for the GPU to draw. You can see the render thread being asleep during the entire time
This is the Entities Graphics Package scheduling draw/culling commands:
Unity.Rendering.EntitiesGraphicsSystem.OnPerformCulling
Ah then you are in the right place. I apologize ^^
I'm not an expert in this but I did spend some time optimizing rendering performance in the built in renderer so my advice is maybe outdated. By using the frame debugger and scrubbing the timeline back and forth I can see what takes up rendering time inside the frame. In most cases I've had problems with batching and me forgetting to properly set up the gameobject to behave as static, when it should.
Again this advice might not be relevant to your setup.
It's not rendering time though, you can see Gfx.WaitForGfxCommandsFromMainThread sleeping the entire time in the render thread. Actual rendering is very fast (1.74ms Render Main Camera) but CPU is heavily bottle necking for some reason.
I'm assuming there's some assumption done in Entities Graphics that's supposed to make shadow casters preparation fast but I can't make it out from looking at the code itself.
It does seem unusually slow, I would try a repro project of just HDRP and compare the cost 
turn on deep profiling and dig in to the culling calls, I've found some odd things going on in there