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

Why is the DirectX 12 renderer slower than the DirectX 11 renderer ?

Discussion in 'General Graphics' started by relativegames, Jul 17, 2016.

  1. relativegames

    relativegames

    Joined:
    Nov 22, 2013
    Posts:
    32
    I just made a test today with the Viking Village demo and noticed how under DirectX 12 on my R9 280X it renders with ~95 FPS while under DirectX 11 it renders with ~110 FPS. This is a huge difference and I was curious as to why is that ?

    Furthermore, perhaps my card is old and not built for DirectX 12. It would be nice if others could test with other cards and share their results.
     
  2. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    1,115
    Maybe you could check the profiler and let us know exactly what is happening? I do expect the DX12 to be faster off the shelf though...
     
  3. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    DX12 can be faster, but can also be slower. In cases where DX11 is rendering a lot of individual objects DX12 will usually be noticeably faster, but in heavily optimized scenes DX11 might be faster.

    There are many reasons for this, but the simplest reason is DX11 has had several years to mature at this point and DX12 has not.

    People like to tout big numbers showing off performance increases with DX12 over DX11, but usually they're not scenes you'd see in a real game simply because they would be too expensive to do in DX11. If you look at the benchmarks for AAA games that have been updated to use DX12 you'll many of them don't any perform faster using DX12, and some are slower.

    One major difference between DX11 and DX12 that people who aren't graphics programmers don't think about is in the phrase "closer to the metal". DX12, Vulkan, Mantle, and iOS Metal have all been described this way. What this means is the command you send to the graphics drivers are close to how the hardware actually works than what previous graphics APIs have exposed, but every version and generation of hardware acts a little differently and there's a hundred ways to do something to get the same visual results.

    Think of a bunch of different graphics cards like a bunch of different artists with different sets of skills. You ask a manager to have them all make to make a single perfect square, but you don't care what technique they use. The manager knows exactly what way every artist should make the square, some can immediately take out a pen and draw a perfect square on some paper, some cut the square from cardboard, some make it out of clay or steel or wood. In the end they all make a perfect square using the technique that they're best at.

    This is DX11, or really any desktop or mobile graphics API prior to Mantle. You asked for a square and the graphics drivers tell the GPU to draw a square on screen the way each video card was best suited.

    Now imagine you personally ask that same group of artists to make a perfect square, but it has to be using steel. Some of the artists would have already been doing using steel and have no problems making it again. Some have done it before but it's not something they're good at so it takes them a while. Some of them are completely useless and end up burning down their shop attempting to use a blow torch for the first time.

    This is DX12. The GPU is going to do exactly what you tell it to do, but unless you know the best technique for each GPU some might be way slower than before. However when you do give them the right technique it's way cheaper / faster because you no longer have to go through a management layer.
     
    radiantboy and Catinightmare like this.
  4. zelmund

    zelmund

    Joined:
    Mar 2, 2012
    Posts:
    437
    all tests on unity 5 - 2019 in different projects and hardwares shows DX12 slower than DX11 in all cases.
    it worse kick on HDRP DXR.
     
  5. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    DX12 is required for DXR raytracing, and raytracing is expected to be way slower, so that's not a surprise.

    And I was talking about the general case for DX11 vs DX12. Since Unity is still a DX11 renderer at its core, it probably can't fully utilize the functionality that makes DX12 faster. And again, it's very rare for a Unity game to even be structured in a way that DX12 would have an advantage.

    Ashes of Singularity is still perhaps the only title with options for running in several different APIs that shows clear advantages using DX12, and even then only on AMD hardware (possibly since it was originally a Mantle based game engine).
     
    Walter_Hulsebos likes this.
  6. zelmund

    zelmund

    Joined:
    Mar 2, 2012
    Posts:
    437
    so do i.
    i test it by simple switching dx11 and dx12. no DXR using. only common things an common situations.

    i wonder how unreal and unigine utilize dx12.
     
  7. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,866
    DirectX 11 vs 12 vs Vulkan:
    Dx11 : 159 fps
    Dx12 : 103 fps
    Vulkan: 154 fps
    DX11_4K.jpg
    DX12_4K.jpg
    Vulkan_4K.jpg

    Gif comparison:
    DXCOmpareVulkan.gif
     
    radiantboy and Walter_Hulsebos like this.