Search Unity

Bug 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:
    240
    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,496
    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:
    240
    Thanks for the advice, it was not so useful though:

    OpenGLCore
    OpenGlCore.PNG

    DirectX
    DirectX.PNG

    (GPU Usage, with Deep Profiling too)
     
unityunity