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. Dismiss Notice

Bug Failed to present D3D11 swapchain due to device reset/removed. List of Solutions

Discussion in 'Editor & General Support' started by 3dproject, May 28, 2023.

  1. 3dproject

    3dproject

    Joined:
    Jul 26, 2015
    Posts:
    18
    For reference, the bug report is IN-41214.

    So this unrecoverable error can happen for many but essentially your graphic card resets because it's been busy for too long. In my case, if I didn't click ok fast enough I would get a BSOD VIDEO_TDR_FAILURE. I'm listing all the fixes I've found and tried, hoping that it helps you find a fix faster. if you find a fix that's not on the list, please comment on the thread. Remember to include links.

    In my case, Unity was using my integrated GPU instead of my dedicated one.

    To any Unity devs reading this: I completely get that resources are limited and the forum and bug reports are what we should be using, when on a free license. However, this error seems like quite a pain point for the community and it would be great if someone could look into this and make solving this error a bit easier. I hope my collection of solutions makes it easier to investigate. I'm taking the liberty of tagging some Unity devs who have responded to threads about this error. @Tautvydas-Zilys @Soner-Sen @LeonhardP @aleksandrk

    As for bug reporting, in my case, this seems to corrupt some of the files and so the bug report application would throw an error about files being unreadable. And customer support told me they were nontech support only. I eventually got a project to crash without corrupting the files and was told to check my drivers (IN-41214).

    I hope I don't offend anyone with the tags, I've been chipping at this for weeks in my spare time and am genuinely willing to help out in any way I can. Please reach out if I can help.

    1) Set the Prefered graphics card in Windows settings (this worked for me)

    Note: I had confirmed that the editor was using my integrated Intel GPU through the Task Manager's Performance tab. The integrated graphics card is less powerful so it's understandable that this one crashes. And noticed a message in the Nvidia Control Panel that said graphic card selection was handled by Windows now.

    Settings>System>Display>Graphic Settings>"choose an app to set preference">Desktop app>browse

    Find the unity.exe for the editor install you're using and selected, "options" I selected "High performance" which listed my Nvidia GPU

    2) Nvidia Control Panel Settings
    Note: there are two tabs, one for your system and one for specific processes. Use the one for specific processes.

    https://forum.unity.com/threads/cra...te-1709-and-nvidia-issue.505749/#post-3297507

    3) Exclude unity.exe from your processes in your Antivirus settings
    There are a few sources claiming you should disable your antivirus, I suspect that the safety features are slowing down or blocking the GPU processes. I don't recommend turning your antivirus off permanently. you could try temporarily. I don't have all the links but some people have reported success excluding the process or changing antivirus.

    https://forum.unity.com/threads/con...d3d11-swapchain-due-to-device-removed.987834/

    4) Delete the library file in the project file
    https://forum.unity.com/threads/con...in-due-to-device-removed.987834/#post-6723811

    5) Inplace Windows Update
    A Microsoft person recommended I do an in-place upgrade/install of the latest Windows version, just make sure you select the option to "keep my files" and optionally "keep my apps". Not keeping the apps will also reset your settings which is more likely to help.

    NOTE: I have not tried the remaining solutions, as I wanted to avoid changing settings that would affect other applications and I eventually found my solution. However, others have reported success. I highly recommend trying the above solutions first as they are less risky (well... number 7 is fine).

    6) Changing TDRDelay and TDRDdiDelay
    Note: this is a more risky fix as it basically tells Windows to ignore your graphic card when it's unresponsive for a bit longer than usual. this could also cause crashes on your laptop if you completely remove the TDRDelay or set it beyond reasonable values. By crash I mean BSOD VIDEO_TDR_FAILLURE kind of crash. Make sure you bookmark the Adobe link as it has instructions on how to undo this change. it could be the only solution that works if your integrated graphics card is too old/weak to handle the unity graphic demands fast enough to avoid Windows resetting the graphics card.

    https://forum.unity.com/threads/con...swapchain-due-to-device-removed.987834/page-3

    Use the guide below to make the change as it explains in nice detail what you're doing.
    https://substance3d.adobe.com/docum...th-long-computations-tdr-crash-128745489.html

    7) -force-d3d11 or -force-d3d12
    Note: this overrides some of the unity settings, my guess is that without the overrides the dedicated GPU is selected instead of the integrated one.

    https://forum.unity.com/threads/con...in-due-to-device-removed.987834/#post-7246700

    more info:
    https://docs.unity3d.com/Manual/EditorCommandLineArguments.html

    8) Disable Integrated graphics card
    https://forum.unity.com/threads/con...in-due-to-device-removed.987834/#post-7065772

    Note: Don't do this if you only have one graphic card. In fact, you should probably be using the above methods if you have a dedicated graphics card. But hey if nothing works, then you can try this.
     
    Last edited: May 29, 2023
    rubendariohh likes this.
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,725
    Could you please submit this through the bug reporter? If the project is corrupt then try doing it with a new project. A bug report on the forum is going to be very hard for us to track and will likely be lost after a few days. Submit the contents of this post in a bug report and post the bug number. I'll ask QA to take a look and you can then talk to them though the bug report if they have followup questions.
     
  3. 3dproject

    3dproject

    Joined:
    Jul 26, 2015
    Posts:
    18
    I managed to repeat this with another project without the corruption and report it some time ago before making this post (bug number IN-41214), I'll paste this post's text as a follow-up. I've also added the bug number to my original post on this thread.
     
    karl_jones likes this.
  4. rubendariohh

    rubendariohh

    Joined:
    Oct 14, 2017
    Posts:
    31
    I started having this D3D11 issue after updating Windows 11 to 22H2.

    This Windows update is causing mayor issues for Nvidia Cards owners and DX11 based apps.

    For instance, I started having this opened issue by Nvidia when web browsing with Google Chrome. Changing Chrome to use OpenGL instead of DX11 fixed the issue:

    Open Issues:
    Small checkerboard like pattern may randomly appear in Chromium based applications [3992875]

    https://www.nvidia.com/en-us/geforc...orce-grd-53699-feedback-thread-released-8823/

    Unity was working perfectly fine for me before the Windows 22H2 Update. Now I have several D3D11 swapchain crashes. I have to restart my laptop everytime. If I restart Unity without restarting my lasptop the error happens again.

    I follow all these steps with no results:

    Set the Prefered graphics card in Windows settings for Unity (High performance)

    Nvidia Control Panel 3D Settings for Unity (prefer maximum performance, Threaded Optimization off, Tripple Buffering off, Vertical Sync off)

    Lenovo Hybrid Mode turned off

    Last Nvidia Studio Driver Installed


    My Setup:

    Lenovo Legion 5 Pro 16ach6h, Nvidia Geforce Rtx 3070, Unity 2022.3.7
     
  5. Bwacky

    Bwacky

    Joined:
    Nov 2, 2016
    Posts:
    153
    Hi! Any luck fixing this on your end? Some of our PCs still see this, esp. people running 30xx cards.
     
  6. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    12,798
    Nvidia should fix their failed drivers asap, this is getting out of hand.

    I cant imagine how they work producing cards that randomly crash by some erroneous wait time estimation.

    This is a huge bug, i mean out of this world huge. How come noone notice it ? Msybd did not test DX11 at all and focused on the DX12 ?

    Get a new expensive GPU only to be useless crashing all the time, just crazy stuff
     
  7. Bwacky

    Bwacky

    Joined:
    Nov 2, 2016
    Posts:
    153
    I replied with a fix in a few other threads & confirmed it working with multiple others with similar issues. Download nVidia drivers version 527.56 from 12/08/2022 and update once a month or two till they fix the dx11 bug. Worst case roll back.
     
  8. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    12,798
    The issue is that users may use the latest drivers, this is the expected. And games will crash on them. It is a game over situation. This cant be solved by reverting to older working drivers on our side or any other method, this should just work and never crash.

    Now having a driver that crashes the games is beyond imagination, given this did not happen before.

    They are just failed as a company to deliver, breaking something that was working fine even on my old 1050gtx.

    People buy a 4070gtx, just to have constant crashes, is beyond imagination.

    Imo they should stop everything and focus on solving this issue, as selling something that does not work should be illegal and a fraud.

    If is a hardware issue they should recall the GPUs and give actual working hardware to existing users.

    Possibly may also be related to something that Unity does that amplifies this issue, starting with Unity 2021, since 2019 never had such problems.

    This bug imo is a failure of the industry, it is so severe that i cant imagine how can trust any hardware or game to not just crash randomly.

    I wonder why they just dont have an option to let the GPU just wait or change this stall time or remove it since obviously the check is implemented wrong. If they are incompetent to make it work should quit the job. It is like making a house without few of the cement columns and pretend that all is fine and house owner can add a few later to make it work and not fall down.

    An issue like this is not for us to try resolve, is for NVIDIA and Unity to fix and should be their only priority, otherwise they dont have a real business.
     
    Last edited: Sep 22, 2023 at 4:13 AM
  9. Bwacky

    Bwacky

    Joined:
    Nov 2, 2016
    Posts:
    153
    Well I sent in a bug report to NVidia about this, maybe you should too if you can. Is sadly something the driver providers should IMO look at since it affects not just the editor but also game builds, and game crashes tend to be more the job of the actual driver developers.
    Don't think Unity cares about this, much as I wish they did.