I was building a second gamedev machine with some parts I had laying around to use at my father’s (he is ill and need someone to be there for few days) and I started to have “D3D device being lost” with some projects that my main machine was not showing. So I will present a comparison between both hardware and the software fix which removed the issue, at least for now.
main machine: AMD Ryzen 1700 with 32GB RAM and RTX 3070 8GB, project files on a NVMe SSD and tools on a SATA hard drive, OS into a SATA SSD. Motherboard ASUS with 450 chipset
machine with issues: Intel i5 with 32GB RAM and RX5700XT 8GB, project files on a SATA hard drive, tools on a SATA hard drive, OS into a SATA SSD. Motherboard ASUS with B85 chipset
There were project with not much complex shaders which were ok on the second machine, but the projects with complex shaders was hanging for a bit, terminating with a crash reporting the message in question. So, all pointed out that a long operation was making the software stack at the very bottom to think there were issues with the GPU and sent the fault, which was producing then a fault cascade on all the upper software layers, so meaning something between Windows 10 and the GPU drivers.
Then I remembered that Allegorithmic has presented in the past some changes into Windows 10 registry to add a delay to the GPU to give some time for the GPU to finish a long operation and then not producing that fault. These are the steps they suggested:
1 - Open the Run window
Click on Start then Run or press the Windows and R key .
It will open the Run window.
2 - Launch the registry editor
Type " regedit " in the text field and press " OK ".
3 - Navigate to the GraphicsDrivers registry key
The registry window will open.
In the left pane, navigate in the tree to the GraphicsDrivers key by going into: Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers
Be sure to stay on “GraphicsDrivers” and to not click on the Registry keys below before going through the next steps.
4 - Add or Edit the TdrDelay value
If the TdrDelay value doesn’t exist yet , right-click in the right pane and choose New > DWORD (32bit) Value . Name it " TdrDelay ". The case is important, be sure to follow it (and check that there are no other characters such as trailing space).
In the right pane , double click on the value TdrDelay . Change the Base setting to Decimal . Set the value to something else than the default 2 (we recommend 60 ).
This value indicates in seconds how long the operating system will wait before considering that the GPU is unresponsive during a computation.
5 - Add or Edit the TdrDdiDelay value
If the TdrDdiDelay value does not exist , right-click in the right pane and choose New > DWORD (32bit) Value . name it " TdrDdiDelay ". The case if important, be sure to follow it (and check that there are no other characters such as spaces).
In the right pane , double click on the value TdrDdiDelay . Change the Base setting to Decimal . Set the value to something else than the default 5 (we recommend 60 ).
This value indicates in seconds how long the operating system will wait before considering that a software took too much time to leave the GPU drivers.
Hexadecimal is the default value, simply switch to decimal to display the right value. Note that 3C (Hexadecimal) equals to 60 (Decimal).
6 - Finish and Restart
Close the Registry editor. Restart the computer by using Start then Restart .
The TdrValue is only looked at when the computer start, so to force a refresh a reboot is necessary.
I hope this info help you aswel. Values bigger than 60 are possible since they represent the amount of seconds of delay, so you can try 90 or even 120 there.