Search Unity

Gfx.WaitForPresent is "doubling up" on a single frame with Vsync ON.

Discussion in 'General Graphics' started by mr_president, Dec 31, 2015.

  1. mr_president

    mr_president

    Joined:
    Jun 28, 2015
    Posts:
    23


    I think the profiler image explains it best. For some reason Vsync/WaitForPresent is waiting twice on one frame, then not at all on the second frame. I'm using a lot of linear motion and these single frame spikes are very noticeable. Anyone know what could be causing this? I've done a tremendous amount of searching to no avail.

    Edit: Forgot to mention this happens in a completely empty project as well, if Vsync is ON the spikes occur.
     
    Last edited: Dec 31, 2015
  2. mr_president

    mr_president

    Joined:
    Jun 28, 2015
    Posts:
    23
    So I was sortof able to find a solution for this. I forced OpenGL instead of using DirectX, using -force-opengl in the Unity shortcut. Everything runs smooth as butter now, it's beautiful... But what now? Is using OpenGL instead of DirectX a valid way to launch a game? Would this cause other unforeseen problems? Is there a way to make a build with OpenGL instead of DirectX without using the shortcut modifier? I feel like there should be a way to fix this without switching to a completely different renderer.
     
  3. mr_president

    mr_president

    Joined:
    Jun 28, 2015
    Posts:
    23
    I finally figured it out, and like most problems like these it was something incredibly stupid.

    I found a few other people that were having similar issues, and they fixed it by uninstalling a program called f.lux, which changes monitor color tones to help with sleep patterns. I wasn't using f.lux, but I wondered if I might have an outside program causing the issue, and sure enough, I use a program called Display Fusion which gives additional multi-monitor support.... that was the culprit. Nothing to do with Unity, DirectX, or my Nvidia drivers. All those hours searching and tweaking and it was staring me in the face. I figured it out right on the stroke of midnight entering 2016 too, what a day.

    Anyway, to anyone else who might read this in the future having problems with WaitForPresent or Vsync not working properly, close out any programs that could affect your screen refresh rate FIRST, before trying any other fixes. Goodnight and a happy new year.
     
    Salazar likes this.
  4. Salazar

    Salazar

    Joined:
    Sep 2, 2013
    Posts:
    235
    Same here. I figure it out that Windows 7 System visual style has an impact on profiler too.

    upload_2016-1-28_22-31-18.png

    Not: This is a editor profiler. A single sprite 2d scene.
     
  5. Bentoon

    Bentoon

    Joined:
    Apr 26, 2013
    Posts:
    98
    Thanks for the thread I have the same problem on a brand new PC.There is no f.Lux or display calibration installed ... any other ideas?
    WaitforPresent may not be " a Problem" But it is Hogging 80% of even a BLANK Scene!! Could this be linked to Display Color Mgmt? MSI True Color?


    Thanks

    ~be