Creating new Device after DeviceLostError not possible?

In our desktop application, which uses Vulkan, we occasionally get a DeviceLost error. So far we have found three possible causes:

  • Overheating of a client’s laptop
  • Error occurred when unplugging or plugging in a monitor
  • Bugs in our software, where all reproducible bugs have already been fixed

Based on the logs of our application, it can be seen that such errors occur very rarely. Our goal is that the renderer is then reinitialized.
Accordingly, we have rebuilt the application in such a way that a DeviceLost is caught, the render window including Vulkan devices and the instance is destroyed and then a new window, instance and Vulkan device are created.
This works successfully on AMD graphics cards and Intel integrated graphics solutions. Unfortunately, it does not work on Nvidia cards. We have examined the behavior on several systems with Quadro and Geforce cards, almost all of them show the same behavior: vkCreateDevice returns VK_ERROR_INITIALIZATION_FAILED.

I have uploaded a minimal example to reproduce here:
The fragment shader executes an infinite loop, resulting in a DeviceLost. This is caught in main() and an attempt is made to create a new device.

A different behavior could only be provoked on one system:

  • AMD Ryzen 7 3500X
  • 32 GB RAM
  • Windows 10 Pro, 64 bit (20/04)
  • GeForce RTX 2060 SUPER
  • driver: 516.94

Here the call to vkCreateDevice does not return, the application hangs.

The latter behavior is certainly a driver bug and should be passed on to the developers.
It is unfortunate that vkCreateDevice returns an error, even though this is probably allowed by the specification. It would be ideal if another device could simply be created in the same process.