Search Unity

Performance issues on Gfx.WaitForPresent in "Game" mode

Discussion in 'Windows' started by stevegreat, Apr 18, 2018.

  1. stevegreat

    stevegreat

    Joined:
    Sep 24, 2014
    Posts:
    15
    I'm having performance issues when running a UWP build on the Xbox One console in "Game" mode.
    I don't see the issue in "App" mode but when I switch to "Game" mode it runs very poorly.

    upload_2018-4-17_21-41-52.png

    Recovery: 10.0.16299.5101 (rs3_release_xbox_dev_1802.180131-1450)
    Unity 2017.4.1f1
    Player Log attached

    Any tips?
     

    Attached Files:

  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    It looks like you're using Direct3D 12, and that only works in game mode. In "app mode" you can only use Direct3D 11. I'm wondering perhaps that's the difference? Could you check the performance with Direct3D 11 only in Game mode?
     
  3. stevegreat

    stevegreat

    Joined:
    Sep 24, 2014
    Posts:
    15
    Performance is much better in D3D11. I still get spikes from Gfx,WaitForPresent but not nearly as much. Hopefully the remaining spikes are isolated issues I can fix individually.

    Is there a stable set of options I should be configuring for UWP games running on Xbox One? Scripting Backend, graphics API, Graphics Jobs, etc? I'm kind of lost at what is supported on the console. PC builds run much better!

    Thank you!
     
  4. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,609
    I can't find where I can switch between app and game-mode. Where is that option? :confused:
     
  5. stevegreat

    stevegreat

    Joined:
    Sep 24, 2014
    Posts:
    15
    On the console:
    Highlight your app and press the view button.
    Select "View details"
    Select "Game" for the "App type"

    Alternately from the Xbox Device Portal you can check the checkbox "Treat UWP apps as games by default"
    Select "Settings"
    Scrolldown to "Preference Settings"
     
    Peter77 likes this.
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    Can we get a bug report about that D3D12 performance issue? We'd like to fix it - it's clearly not intended.

    PC builds run much better because your PC is likely 5-6 times faster than Xbox One :). All of these settings will unfortunately depend on your content a lot. On some games, graphics jobs will have a big impact on performance, while on others it won't. Direct3D 12 generally shouldn't be slower than Direct3D 11, but you're hitting some kind of weird edge case. As for the scripting backend: we always try to recommend using IL2CPP because it generally has less issues and it has the same .NET API surface as the other Unity platforms, which means you won't have to rewrite your scripts. Lastly, we're deprecating .NET scripting backend soon, so in a year or so IL2CPP will be the only option anyway.
     
  7. stevegreat

    stevegreat

    Joined:
    Sep 24, 2014
    Posts:
    15
    Thank you for the detailed response! Not sure if I'll move to IL2CPP yet because I ended up with more issues and find them harder to debug after the conversion to C++ code but I'll keep it in mind.

    Looks like on Master builds I only have one major bottleneck to fix to get the frame rate higher so D3D11 will work for me for now.

    Thanks again!