How can I simulate a DeviceLost event with Win2D?

北战南征 提交于 2019-12-03 04:51:10

It's not possible to trigger a device lost event with an API, but there is a command line tool you can use:

DXCap.exe -forcetdr

The version of DXCap you need is part of the Graphics Tools for Windows 10 package, for Win10 build 10586 or later: https://msdn.microsoft.com/en-us/library/mt125501.aspx#InstallGraphicsTools

After installing the VSGD, you can find DXCap in the windows\system32 directory.

Unfortunately it looks like this option is not (yet) documented, but from the command line:

  -forcetdr          Don't capture or replay, but simply force a GPU Timeout
                     Detection and Recovery event, then exit.

What the @Simon described is documented here at the bottom of the page:

Handle device removed scenarios in Direct3D 11

Direct quote from the link above:

Visual Studio's Developer Command Prompt supports a command line tool 'dxcap' for Direct3D event capture and playback related to the Visual Studio Graphics Diagnostics. You can use the command line option "-forcetdr" while your app is running which will force a GPU Timeout Detection and Recovery event, thereby triggering DXGI_ERROR_DEVICE_REMOVED and allowing you to test your error handling code.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!