Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. We are looking for feedback on the experimental Unity Safe Mode which is aiming to help you resolve compilation errors faster during project startup.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

[Solved] 2017.1 - OSX Metal performance issue - Gfx.WaitForPresent

Discussion in '2017.1 Beta' started by radimoto, Jun 28, 2017.

  1. radimoto

    radimoto

    Joined:
    Aug 23, 2012
    Posts:
    257
    Hey all,

    I have run into a performance issue with my project only on OSX Metal.
    I had a good build on 2017.1.0b10 that could maintain 60fps at 2560 x 1440 using an nVidia GTX 970.
    I then enabled GPU Instancing on a lot of materials, after which I can only every get 20fps.
    If I disable Metal and just use glcore, I can maintain 60fps again.

    My IOS (iPhone 6S) and Windows builds (4K resolution, 980m) all maintain 60fps.

    I've gone back and disabled GPU Instancing across all materials but the problem still remains.
    In the profiler all I see is Gfx.WaitForPresent, which I thought could be caused by GPU Instancing but with it fully disabled I'm a bit lost on what it could be?

    The performance issue with Metal is also occurring on 2017.1.0f1.
    If I switch to glcore it runs perfectly smooth at 60fps.

    I haven't submitted a bug report yet as the project is pretty large and I'm short on time to strip it down for repo.

    Any ideas or thoughts would be appreciated!

    Thanks,
    Andrew
     
    MrEsquire likes this.
  2. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,434
    As far as I know Gfx.WaitForPresent means the CPU is waiting for the GPU, so it doesnt really narrow things down that much. If you enable GPU profiling do you get a better sense of what is causing the poor performance?

    Does this performance issue happen both in the editor and in executable builds?
     
  3. radimoto

    radimoto

    Joined:
    Aug 23, 2012
    Posts:
    257
    GPU profiling isn’t available unfortunately.
    I’m using the nvidia web drivers with a GTX 970.

    I get 60 fps in the editor, which is using metal.
    My build however never gets above 20fps unless I run it at a lower resolution. 1280x720 for example runs at 60fps.
     
  4. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    2,116
    Hi radimoto,
    It would help a lot if we could get a bug report with a minimal reproduction case from you. There haven't been any other reports on this matter so far.
     
  5. radimoto

    radimoto

    Joined:
    Aug 23, 2012
    Posts:
    257
    Have done some more testing tonight...

    if I switch platform to IOS the editor (metal) runs at 60 fps no problem.
    If I then switch platform to OSX the editor (metal) is limited to 20 fps with Gfx.WaitForPresent shown in the profiler.
     
  6. radimoto

    radimoto

    Joined:
    Aug 23, 2012
    Posts:
    257
    OK I have managed to isolate and resolve the issue :)

    I had an orthographic camera in my scene on my UI layer, with a culling mask of UI.
    The thing is I had switched my UI from using this camera to having a canvas using "Screen Space - Overlay". This camera is no longer even required but I still had it enabled :(

    With this camera enabled:
    glcore runs fine in both editor and build - 60 fps (this my vsync fps)
    metal (platform = IOS) runs fine in both editor and build - 60 fps
    metal (platform = standalone, OSX) massive Gfx.WaitForPresent and maximum 20fps

    As soon as I disable this camera both the editor and my build (using metal, platform = standalone, OSX) works perfectly with 60 fps.

    Problem solved !!!
     
  7. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    821
    The problem may be solved but it does definitely sound like a bug is involved, so I would still make a repro and submit it to Unity.
     
    Noisecrime likes this.
unityunity