Search Issue Tracker

Won't Fix

Votes

8

Found in

2021.3.30f1

2022.3.10f1

2023.1.14f1

2023.2.0b10

2023.3.0a6

Issue ID

UUM-49251

Regression

No

D3D11 swapchain error pop-up appears and the Editor shuts down when opening a project

--

-

Reproduction steps:
1. Download, extract and open the attached “repro-project“

Expected result: The project opens successfully
Actual result: A “Unity Error“ pop-up appears, and the Editor shuts down

Reproducible with: 2021.3.30f1, 2022.3.10f1, 2023.1.14f1, 2023.2.0b10, 2023.3.0a6

Reproduced on: Windows 10 Pro, Windows 11 (by reporter)
Not reproducible on: No other environment tested

Note:
1. The full error: ”Failed to present D3D11 swapchain due to device reset/removed. This error can happen if you draw or dispatch very expensive workloads to the GPU, which can cause Windows to detect a GPU Timeout and reset the device. (see [https://docs.microsoft.com/en-us/windows-hardware/drivers/display/timeout-detection-and-recovery).|https://docs.microsoft.com/en-us/windows-hardware/drivers/display/timeout-detection-and-recovery).If] if you believe this error is due to built-in Unity functionality, please submit a bug. This is an unrecoverable error and the editor will shut down.”
2. Originally the project crashed after opening a scene with the following first few lines of the stack trace:
0x00007FF7B735590C (Unity) TexturesD3D11::UploadTextureSubData2D
0x00007FF7B7349ED7 (Unity) GfxDeviceD3D11Base::UploadTextureSubData2DImpl
0x00007FF7B7101118 (Unity) GfxDevice::UploadTextureSubData2D
0x00007FF7B89DE6A5 (Unity) GfxDeviceWorker::RunCommand
0x00007FF7B89E768B (Unity) GfxDeviceWorker::RunExt

  1. Resolution Note:

    The project fails to open because RayTracingMaster.cs is executed right after the project is done loading. The problem with the script is that it contains dispatches/Graphics.Blit calls that may result in compute shader executions or draw calls that take longer than 2 seconds, which then result in TDR. We don't have control over this timeout limit as it is set by Windows. It is possible to override the 2 second default value with something greater by modifying the value of TdrDelay in Windows registry but it is not recommended, Instead, splitting up the work in a way that each shader execution takes less than 2 seconds is advised.

    To get the project opening again it is enough to comment out or remove the annotation: [ExecuteAlways, ImageEffectAllowedInSceneView] from the RayTracingMaster class in RayTracingMaster.cs

    Instructions on how to modify the default TdrDelay:
    1. Open the Run dialog box by pressing Windows + R keys on your keyboard.
    2. Type regedit and click OK to open the Registry Editor.
    3. Navigate to the following path:
    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\GraphicsDrivers
    4. By expanding the folders on the left pane.
    5. Right-click on an empty space on the right pane and select New > DWORD (32-bit) Value.
    6. Name the new value as TdrDelay
    7. Double-click on the new value and enter a desired value in the Value data field (for example, 10 for 10 seconds).
    8. Click OK to save the changes.
    9. Restart your computer for the changes to take effect.

Comments (3)

  1. esraahamad97

    Jan 18, 2024 18:40

    It's working 💪

  2. 8bit4life

    Dec 03, 2023 16:18

    "Won't fix"? How do you mean? This crashes the GPU for the entire machine. P1 bug.

  3. ChaacInfo

    Sep 15, 2023 20:01

    I opened the task manager and I can see the commited memory increasing like crazy. It just never stops. I then resetted Unity's layout and it "kinda" stopped, but whenever the scene view is resized, the memory keep increasing.

    I opened the project in a previous version of Unity (2022.2.12) and the commited memory is stable. It increases when the scene view is resized, but goes back to its previous value quite quickly.

    My guess is that it never releases the previous textures allocated for the scene view. We also get this error right before Unity crashes:

    Assertion failed on expresion 'rs && rs->m_Texture && rs->m_SRView'.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.