Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  3. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Official DX12 is out of experimental since 2022.2.0a17

Discussion in '2022.2 Beta' started by tvirolai, Jun 28, 2022.

  1. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    > d3d12: Profiler is enabled, but stable power state is not. GPU timing errors are expected.

    Every time i start the editor i see this message, and i dont know what to do with it. What is stable power, where do i enable it?
     
  2. guoxx_

    guoxx_

    Joined:
    Mar 16, 2021
    Posts:
    55
    launch unity.exe with following argument: -force-d3d12-stablepowerstate
     
  3. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    Thanks for the answer. Not seeing this command in the documentation, nor does the warning inform in any way how to solve it. Really think that something out of experimental should be more polished.
     
  4. tvirolai

    tvirolai

    Unity Technologies

    Joined:
    Jan 13, 2020
    Posts:
    79
    Enabling it will actually reduce your performance. It's in order to get stable profiling results.

    https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device-setstablepowerstate see here for more information on what it actually means.

    We probably should improve our documentation for what it does and means. If you're not doing fine grained profiling you should ignore it.
     
    Kmsxkuse and TJHeuvel-net like this.
  5. dnach

    dnach

    Unity Technologies

    Joined:
    Mar 9, 2022
    Posts:
    90
    With the aim of further improving DX12 performance, 2023.1a21 introduces a new graphics jobs threading mode called “Split Graphics Jobs”. The new threading mode is now the default for DX12 Standalone Players, with support for additional graphics APIs in our roadmap.

    For more information, including performance figures from our internal tests, please check the official forum post:
    https://forum.unity.com/threads/directx12-and-graphics-jobs-improvements-in-2023-1-split-graphics-jobs-and-editor-support.1375098/
     
    olavrv and m0nsky like this.
  6. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    667
    Great work bringing DX12 forward! I tried it out to get an early glimpse of potential performance. I'm seeing about a ten percent drop in fps performance across different scenes. This isn't a complaint -- I know it's hot off the press and further optimization is planned. I'm looking forward to trying it again in the future.
     
  7. mluchian

    mluchian

    Joined:
    Aug 24, 2022
    Posts:
    6
    A couple of people mentioned that Nsight Graphics works fine when the D3D12 Graphics API is enabled. I'm having the exact opposite problem, each time I try to start a standalone alone D3D12 build from Nsight Graphics, the build just crashes. To exlude any issues due to my code, I tried the HDRP sample scene and it still crashes.
    Some help with this would be greatly appreciated.
     
  8. sbsmith

    sbsmith

    Joined:
    Feb 7, 2013
    Posts:
    126
    We are seeing a 4-10x performance drop between 2022.2.2 and 2022.1.24 in URP. Also we are seeing two different types of crashes in the editor and in builds. In the editor, we see this:
    Screenshot 2023-01-12 120505.png

    And in the build we see this:
    Code (CSharp):
    1. Device removed reason (887a0006).
    2. GfxDevice was not out of Local memory
    3. Local memory usage:
    4. Budget: 9750708224
    5. CurrentUsage: 2200891392
    6. AvailableForReservation: 67108864
    7. CurrentReservation: 5009571840
    8. GfxDevice was not out of Non-Local memory
    9. Non-Local memory usage:
    10. Budget: 16334927872
    11. CurrentUsage: 238055424
    12. AvailableForReservation: 0
    13. CurrentReservation: 8301681664
    14. Set -force-d3d12-debug for more information on device removal
    15. Device removed reason (887a0006).
    16. Crash!!!
    Rolling back to 2022.1.24 fixes everything

    What's the best way for us to submit useful information because we don't have much to go on?

    Update: Player is set to auto-detect the API. We have been able to get more stability in the editor by forcing it to DX12, but that seems to increase crashes in the builds. (Also, sadly, I'm working on an older laptop with a GTX 1060 that can't update its drivers and I seem to be the only one on my team spared from these errors)

    Update 2: I'm now being told the swap chair error is still happening after the rollback in the editor, but the build is still stable and the performance is better.
     
    Last edited: Jan 19, 2023
  9. zedz

    zedz

    Joined:
    Aug 31, 2013
    Posts:
    261
    Performance parity?
    Whenever I update Unity, I wait until the 3rd release of a major update to upgrade (X.X.3f1) , and I try out DX12 only to quickly disguard it and go back to dx11, but after hearing dx12 is now official I had high hopes this time.

    But with the Standard pipeline performance is still terrible (plus there are rendering errors to boot)
    DX11 ~110fps > DX12 ~50fps nvidia1650 & 2022.2.3
    Is this parity only with HDRP or is it standard pipeline as well?
    The only thing I want from dx12 is adaptive resolution scaling
     
    Genebris likes this.
  10. Genebris

    Genebris

    Joined:
    Mar 18, 2013
    Posts:
    144
    It's also terrible in HDRP.
     
  11. azmi_unity

    azmi_unity

    Joined:
    Dec 13, 2020
    Posts:
    62
    In my project, transparent materials starts glitching out when there are over 10k instances on camera. I'm using ECS1.0 though, but DX11 works fine.

    HDRP 14.0.6 on Unity 2022.2.11
     
  12. Blade_Master_2020

    Blade_Master_2020

    Joined:
    Aug 3, 2019
    Posts:
    38
    Same here. We switched our HDRP project from DX11 to DX12(officially released), and the FPS drops from 80 to 45.
     
  13. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,958
    Come on guys, it hasn't even been 10 years since they announced their plans to support DX12 early in the Unity 5 cycle, you can't yet expect the support to be good a mere 8 years later.
    upload_2023-4-30_23-29-48.png
     
  14. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    I'm trying to use NSight to profile our shaders, however when starting (in dx12) i get this message, and then our player just crashes. Is this a bug, or intended?
    upload_2023-6-14_18-47-26.png

    Stack trace has this:

    This doesnt happen when i select GPU Trace Profiler, but when i want to use the Frame Debugger it simply crashes.
     
    Last edited: Jun 14, 2023
    Genebris likes this.
  15. tvirolai

    tvirolai

    Unity Technologies

    Joined:
    Jan 13, 2020
    Posts:
    79
    It's not intended. But it's actually a bug in nsight. We don't use D3D11on12. We do have a real genuine DX11 context for video decoding, and only for video decoding, with all the normal rendering happening in real DX12. Previously Nsight has complained about the DX11 context but it hasn't crashed (And also doesn't crash for me(tm)).

    We could solve this by making a completely new video decoding backend that uses the D3D12 video but what we are currently doing is also perfectly within spec. And writing a new video decoding thing just to circumvent a bug in nsight is bit of a large ask. Eventually we will rewrite it but as for now the current one works fine.
     
  16. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    Thnx for your reply, ill try to do a bugreport with them.

    Even if i supress the message Unity crashes for me, 2022.2.20. Also happens in an empty test project.
     
  17. tvirolai

    tvirolai

    Unity Technologies

    Joined:
    Jan 13, 2020
    Posts:
    79
    A correction! It's not actually the video after all. It's a codepath that does create D3D11On12 context but which is never ever actually used in any rendering (just to grab one DXGI interface). Nonetheless it has worked flawlessly except for the error message.

    Video causes similar but not exactly the same error from nsight, hence the initial confusion,
     
  18. Arnold_2013

    Arnold_2013

    Joined:
    Nov 24, 2013
    Posts:
    287
    Is Dx12 supported for Unity 2022.3.X (LTS) for XR? specifically openXR for Windows running in SteamVR?

    Edit: should it matter, I am on URP forward+, with unity ECS Graphics.

    (For me it crashes a lot, but not always and not at the same spot. But it fixes a quality of life issue I was having with dx11. I am CPU bound so I would like to make this work. )
     
  19. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    Our project still runs a lot slower on d3d12, compared to d3d11. We'd love to submit the project as a testcase as i think its a good example of a large Unity project.
     
    Genebris likes this.
  20. Genebris

    Genebris

    Joined:
    Mar 18, 2013
    Posts:
    144
    I get 20 ms player loop on DX11 vs 30 ms on DX12. With a very basic scene of just terrain and some grass. It looks like everything is just more expensive on the GPU. GBuffer is going from 2ms to 3.5ms.
     
  21. julian-moschuering

    julian-moschuering

    Joined:
    Apr 15, 2014
    Posts:
    529
    hopeful likes this.
  22. tvirolai

    tvirolai

    Unity Technologies

    Joined:
    Jan 13, 2020
    Posts:
    79
    That's unfortunately what DX12 mandates. D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT is 64KB. We really cannot do anything about it as long as the user allocated buffer is an actual API buffer.

    The only thing we could do is to make it so that a buffer that user allocates is not actually API level buffer but we'd just offset bind it from larger real buffers behind the scenes. Downside of that is that barriers in DX12 are always for the whole buffer so we could end up in situations like passing a buffer to user that has an UAV and and an SRV and they're used at the same time. But that's an impossible state so it would not work. That's major reason why we do give actual real API buffers on DX12 side.

    Users can mitigate this by doing offset binding themselves and allocating larger buffers.