#Lots of CPU time (40ms) spent every frame in static scene

1 messages · Page 1 of 1 (latest)

manic pike
#

I have 300 trees with branches made up of 3900 segments in total. Each segment uses the same mesh, and I deform them into shape using a shader. The GPU work takes a small fraction of CPU time (40ms), which I find quite surprising.
The bulk of the time is spent in PlayerLoop & UpdateScene as in the screenshot.

The only thing that has an Update() is the camera that orbits around the scene. So the view does change every frame, but not anything in the scene.

I have 4 passes defined in the shader that renders the tree branches in the vertex function: Forward Lit, Shadow Cast, Depth Only, Depth Normals. All 4 use the same bit of vertex code. But I think that's all GPU work, so can't see how it's contributing to that long 40ms.

CPU is an 8259U, not the fastest but by no means slowest either. And I get 3ms (!) in Godot for the same scene with the same number of objects.

Unity 6.3.7 on URP.

Why? LMK if you need more info

dusty hamlet
manic pike
#

Hmm I think that's the CPU waiting for the GPU to render so it may be a GPU bottleneck afterall

dusty hamlet
#

I really doubt your GPU takes 40ms to render the scene. While 9kk verts is a lot, it's probably shouldn't take more than 16ms on an average modern gpu.
You can check your GPU usage in the task manager. If it's far from 100% it's likely not a GPU bottleneck. You could try looking at the gpu module of the profiler, but if you're using URP/hdrp, it might be quite inaccurate. Still, might be good enough to see the overall metrics.

manic pike
#

It's quite possible as it's an iGPU LOL. But the profiler saying 40ms CPU on the left is really confusing.

#

I'll run the same 'benchmark ' on my 9070xt PC soon. What do you mean by overall metrics, where do I get those? Happy to check when I run it on the other PC in a bit

dusty hamlet
dusty hamlet
#

It might even have some correct timings per pass.