Skip to content

Profiler: Overhead Gfx.WaitForPresent explained

mika edited this page Aug 20, 2020 · 3 revisions
  • WaitForTargetFPS: Time spent waiting for the targeted FPS specified by Application.targetFrameRate. The Editor doesn’t VSync on the GPU and instead also uses WaitForTargetFPS to simulate the delay for VSync.

  • Gfx.ProcessCommands: This sample on the render thread encompasses all processing of the Rendering commands on the render thread. Some of that time might be spend waiting for VSync or new commands from the main thread, which can be seen from it’s child sample Gfx.WaitForPresent.

  • Gfx.WaitForCommands: This sample indicates that the render thread is ready for new commands and might indicate a bottle neck on the main thread.

  • Gfx.PresentFrame: This render thread sample is time spend waiting for the GPU to render and present the frame, which might include waiting for VSync.

  • Gfx.WaitForPresent: When the main thread is ready to start rendering the next frame, but the render thread has not finished waiting on the GPU to Present the frame. This might indicate that your game is GPU bound. Look at the Timeline view to see if the render thread is simultaneously spending time in Gfx.PresentFrame. If the render thread is still spending time in Camera.Render, your game is CPU bound and e.g. spending to much time sending draw calls/textures to the GPU.

https://forum.unity.com/threads/profiler-gfx-waitforpresent-and-editorloop-too-high-with-vsync-off.620854/#post-4235935

also, To everyone who still has problems with Semaphore.WaitforSignal, this is just a generic "Unity is waiting for something" marker in the profiler. It's not specific enough for us to have any idea about the problem you are facing. The important bit to report is the name of the marker that appears above it.

As an analogy, it's like the difference between "I pressed a button" and saying which button. I appreciate this isn't necessarily obvious, as it's a technical detail - we are continually working on making profile marker names as meaningful as possible.

A couple of examples:

https://forum.unity.com/threads/extremely-slow-editor-in-2019-2-0a7.640354/page-3#post-5274540 In this post, the important bit is WaitForTargetFPS. This is Unity saying "I can run faster than the target framerate, so I need to wait a bit to make sure we run at the requested FPS. This isn't a bug.

https://forum.unity.com/threads/extremely-slow-editor-in-2019-2-0a7.640354/page-3#post-5123180 This is the one I fixed, where Canvas.BuildBatch was waiting for rendering to finish on another thread. This wait is now totally gone.

https://forum.unity.com/threads/extremely-slow-editor-in-2019-2-0a7.640354/page-3#post-5294883 This one appears below Gfx.WaitForPresentOnGfxThread. Usually, this means that the GPU is the thing limiting your framerate. This means it's probably time to use a GPU profiler, or other means to analyse how many vertices/pixels/big textures/etc you are asking to be drawn. Or maybe the frame stats will tell you that you are drawing way too much stuff. Etc.

https://forum.unity.com/threads/extremely-slow-editor-in-2019-2-0a7.640354/page-3#post-5392530

--

older info, https://forums.oculus.com/developer/discussion/comment/260638/#Comment_260638