When I run my game I get a steady 15-20 FPS, which is much lower than it should be. Profiling the build shows that every frame most of the time goes into WaitForTargetFPS, which implies that the target FPS is ~15-20. However, there is no target FPS, and even when I set it explicitly in code (to e.g. 300), the results are the same. Having Vsync on or off in the Player settings makes no difference.
In the editor, if I run in a small window I get ~90FPS, in maximized I get 15-20 FPS as well. Here too, almost all of the time goes into waiting for the GPU. I have no idea why. I’ve attached screenshots of the profiler both for the build and for the editor.
I’m developing and running on a Mac, same result on both 2019.4.5f1 and 2019.4.12f1 (tried to see if updating helped).
Hi there,
I just double checked the documentation for that WaitForTargetFPS sample and you are right, it is confusingly narrow focused on Application.targetFrameRate or QualitySettings.vSync count. I’ll see if we can’t clarify this further. Because this sample is also emitted if the main thread is just generally waiting on the GPU to finish.
So you’d need to look at this via the Timeline View to check out what’s going on on the Render Thread in parallel. I’m expecting there’d be a rather long sample on Gfx.PresentFrame as the window scaling you described seems to hint that you’re fill-rate bound and therefore GPU bound.
Thanks very much for your reply! I followed your suggestion and checked the render thread in the timeline view (had no idea there was anything below the main thread there), and the GPU is indeed busy for a while. Since my first post I’ve made some improvements that helped (more batching, no AA, less shadows, etc), but it still dominates the time per frame and is especially bad every third frame:
Am I reading this correctly and is post-processing to blame? I only have some color grading and bloom, and while disabling both of those did mostly get rid of the peaks above, the “PostProcessLayer” still takes ~12ms every frame. Is this expected behaviour?
I’m on Mac and Metal is not supported by the GPU profiler, but I’ll look into alternatives.
That’s how I’d read that, yes. But tbh my knowledge on the Postprocessing stack is pretty slim. Might be worth investigating further and then maybe raising more specific questions in more specific sub-forums?