Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  4. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

GFX.WaitForPresent (yes, another one...)

Discussion in 'Android' started by droolz, Jan 27, 2016.

  1. droolz

    droolz

    Joined:
    Apr 29, 2009
    Posts:
    32
    Hey All,

    So I've been pouring over the forums to try and understand what potentially 'Gfx.WaitForPresent' actually means / represents, and I'm still not entirely clear. See the screenshot below:
    profiler.png
    This is taken from a Samsung S6 ADB connection to profiler (ie build and run). Project has VSync set to off.

    As you can see, the gpu is doing very little (find it hard to believe that it's actually that fast), but the cpu has varying degrees of 'Gfx.waitforpresent' going on. It does however correlate with when there's a lot going on on screen : the more characters there are, the higher the GFx.waitforpresent and the lower the framerate. What I want to know is what's hidden inside this 'black box'? Is this just a limitation of a the profiler? Are there any explanations anywhere that don't just say 'it's vsysnc'?

    Many thanks for any help,

    Jules
     
  2. xCyborg

    xCyborg

    Joined:
    Oct 4, 2010
    Posts:
    476
    Man that's a recurring problem
     
  3. xCyborg

    xCyborg

    Joined:
    Oct 4, 2010
    Posts:
    476
    Ah ah
     
  4. florianpenzkofer

    florianpenzkofer

    Unity Technologies

    Joined:
    Sep 2, 2014
    Posts:
    180
    You should only see Gfx.WaitForPresent when you are using the threaded renderer.
    It means that the main thread is waiting for the render thread to finish the previous frame (in terms of API calls, *not* synchronizing with the GPU).
    So you are either CPU limited on the render thread (too many or too expensive or stalling API calls, not likely) or some API call (typically SwapBuffers or Clear) is blocked by the driver because the GPU is the bottleneck (more likely).
     
  5. Mafutta

    Mafutta

    Joined:
    Sep 30, 2014
    Posts:
    24
    Ok, so I did a standalone Linux built using Unity 5.6.0b10 and also see Gfx.WaitForPresent. Note: I don't have a GPU. See attached profiler. Any ideas as to what I should/can do about it?
     

    Attached Files:

  6. BrandyStarbrite

    BrandyStarbrite

    Joined:
    Aug 4, 2013
    Posts:
    962
    Ahhh. Thanks for that info.