Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

HUGE performance difference between OpenGLCore and DirectX

Discussion in '2D Experimental Preview' started by ThundThund, Jun 3, 2021.

  1. ThundThund

    ThundThund

    Joined:
    Feb 7, 2017
    Posts:
    287
    I'm using v2020.3.4 with URP 10.4.0 2D Renderer, and vsync off.
    If I choose OpenGLCore in the Project Settings, I get 20 FPS, for example. If I choose DirectX, I get 40 FPS, the double.
    I've check the profiler and the main difference is that when using OpenGL, there is an entry in the CPU Usage called "Gfx.WaitForPresentOnGfxThread". I remark: vsync is off. This entry appears every N frames, consuming 21 ms.

    Here you can see the profile when using DirectX:
    CaptureDirectX.PNG
    And here when using OpenGLCore, at the frame where the suspicious entry appears:
    CaptureOpenGLCore.PNG

    Is this an expected behaviour or a known issue? Why does it happen?
     
  2. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    5,965
    Gfx.WaitForPresentOnGfxThread means that the CPU is idling waiting for the GPU to finish rendering the frame. You can turn on the GPU profiler here:

    upload_2021-6-22_14-59-28.png

    That gives you a GPU profiler, so you might be able to check what's actually taking up the extra time on OpenGL.
     
  3. ThundThund

    ThundThund

    Joined:
    Feb 7, 2017
    Posts:
    287
    Thanks for the advice, it was not so useful though:

    OpenGLCore
    OpenGlCore.PNG

    DirectX
    DirectX.PNG

    (GPU Usage, with Deep Profiling too)