#help understanding frame drops

1 messages · Page 1 of 1 (latest)

slim hare
#

i asked about a perf spike like this before this wonderful forum reorganization and then took a pause from assessing it, but still can't make sense of what's going wrong.

can anyone explain why this frame spiked to 66.67ms, when all the cpu bound work on both the main and render threads finished in ~15ms?

my understanding is that remaining time in the frame (spend on e.g. WaitForTargetFps) is vsync. but why would vsync consume 3 extra frames worth of time here?

dark steeple
#

This is likely some kind of hardware vsync of sorts.

slim hare
#

i've been reading https://unity.com/resources/ultimate-guide-to-profiling-unity-games and the frame it describes for gpu-bound perf doesn't seem to match this one:

Your application is GPU-bound if the main thread spends a lot of time in Profiler markers such as Gfx .WaitForPresentOnGfxThread, and your render thread simultaneously displays markers such as Gfx .PresentFrame or <GraphicsAPIName>.WaitForLastPresent.

#

(in this case, the main thread is waiting on WaitForLastPresent and the render thread is waiting on the main thread)

dark steeple
#

Can you open the GPU module of the profiler and have a look there as well?

slim hare
#

no, unfortunately

dark steeple
#

Hmm. You could try disabling the graphics jobs temporarily in the project settings.

#

Other than that:

  • if you have several monitors, try disconnecting them and test with one only.
  • if your monitor has some kind of syncing settings, try disabling the.
  • check you GPU control panel for any syncing settings
#

Also, are you profiling a build?

slim hare
#

yes, it's a build. i appreciate your suggestions, i think they would establish that this is vsync. however, even assuming that's true, i'd like to understand why vsync would ever take over 3 frames worth of time in a single update, because that doesn't match my understanding of how the technology might work. so if anyone has first-hand experience / understanding of why that might happen, or if that is indeed what's happening, that'd be really helpful!

dark steeple
#

There is a slight chance that it's you messing with vsync or target framerate settings though.

#

Can you share your vsync settings and confirm that you're not setting target framerate anywhere in your code?

opal parrot
slim hare
#

no minimap, but we do have a couple extra cameras that use render textures:

  1. sky is a render texture from another camera used as the skybox for the main camera
  2. blob shadow is a projector using a render texture from another camera
  3. another camera uses a render texture that we read using AsyncGPUReadback
#

1 & 2 are culled to very narrow layers. 3 looks at the same geometry as the main camera, though its rt is very small, like 16x16.

opal parrot
#

then if things improve, try turning them back on one at a time to figure out which code is responsible

slim hare
#

yeah interesting idea, it is (perhaps coincidentally) 4 cameras and a maximum observed vsync of 4 frames. do you have a theory as to the mechanical explanation behind the thought? it shouldn't vsync every camera independently, serially, and only sometimes, right?

winged hamlet
#

Is this reproducible every time?

opal parrot
#

it sounds like you are using basic render pipeline