Search Unity

Weird vsync issue causing regular fps drops only in windows build

Discussion in 'Windows' started by David_Faulkner, Jan 14, 2020.

  1. David_Faulkner

    David_Faulkner

    Joined:
    Oct 5, 2013
    Posts:
    33
    Hello,

    I'm working on a project using Unity 2018.4.11f1 and I'm experiencing a strange fps issue when vsync is enabled in the windows build.
    Roughly every second the fps drops off to 30fps for a few frames before going back up to 60. This only happens in the windows build. In the editor it runs at a solid 60 fps, and if I do a build with vsync off it runs around 200fps.

    From my testing it seems like it could be related to my graphics card drivers throttling the gpu. It's almost like it easily hits the target frame rate, then throttles back to far so the frame rate drops and it throttles back up.

    Here is what I'm seeing in the profiler:
    vsync_issue.jpg

    My gpu is an amd rx580. I've tried updating and performing a clean driver install with no luck, but I've not noticed this problem in any other games. On other computers with nvidia cards the game runs fine.

    Anyone out there seen anything similar to this before?

    Cheers
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    What is QualitySettings.maxQueuedFrames set to?
     
  3. David_Faulkner

    David_Faulkner

    Joined:
    Oct 5, 2013
    Posts:
    33
    Thanks for the reply.

    We're not setting the maxQueuedFrames so I'm assuming it's the default 2.
    Interestingly, if I disable vsync and set Application.targetFrameRate to 60 the game runs fine.

    Here are the rest of the quality settings I'm testing with: Unity_K9t9bT1Mrp.png

    I'll try running some tests with older graphics drivers - maybe there's some weirdness going there.
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    What does the GPU usage in task manager look like during spikes like this? Is the monitor the game is on plugged directly into the graphics card?
     
  5. David_Faulkner

    David_Faulkner

    Joined:
    Oct 5, 2013
    Posts:
    33
    Yeah, the monitor is plugged directly into the graphics card. Here's a comparison of GPU usage with vsync enabled, and vsync disabled with targetFrameRate set to 60:
    vsync_issue_gpuLoad.jpg

    In task manager the GPU usage is sitting around 50% in both cases, but looking at the readout from the radeon software it seems like the problem is related to the clock speed. With vsync enabled it jumps around between 300 to 1125MHz and with vsync disabled and the target frame rate set to 60 it sits at a consistent 1366MHz.
     
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    This really does sound like a driver issue :(. One last troubleshooting thing I can suggest: can you open Windows Performance Recorder and record the trace of it happening using these settings?

    upload_2020-1-16_11-24-50.png

    Then, zip the trace up, upload it to some online storage (like dropbox, google drive, one drive, etc) and PM me the link? That might help me figure out what's going on here.