Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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

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

  1. droolz

    droolz

    Joined:
    Apr 29, 2009
    Posts:
    34
    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:
    633
    Man that's a recurring problem
     
  3. xCyborg

    xCyborg

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

    florianpenzkofer

    Unity Technologies

    Joined:
    Sep 2, 2014
    Posts:
    479
    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:
    45
    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:
    2,074
    Ahhh. Thanks for that info.