在 Windows 10 上将 D3D11 调试层与 VS2013 结合使用

Use D3D11 debug layer with VS2013 on Windows 10

在我的 D3D 11 项目中,我总是添加

#if (defined(DEBUG) || defined(_DEBUG))
deviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif /* (defined(DEBUG) || defined(_DEBUG)) */

添加到设备创建标志以启用调试输出。自从我升级到 Windows 10,这就不再起作用了。设备创建失败,输出如下:

D3D11CreateDevice: Flags (0x2) were specified which require the D3D11 SDK Layers for Windows 10, but they are not present on the system. These flags must be removed, or the Windows 10 SDK must be installed. Flags include: D3D11_CREATE_DEVICE_DEBUG

但是,我无法使用 Windows 10 SDK,也无法将项目从 VS2013 升级到 VS 2015 atm。有什么方法可以解决这个问题,即我可以使用 VS2013 在 Windows 10 上启用 D3D11 调试层吗?

调试消息有点误导。对于 Windows 10,Windows SDK 不再安装 Direct3D 调试层。相反,您需要启用名为 "Graphics Tools" 的 Windows 可选功能,其中包括调试层。在 Windows 10 上安装 VS 2015 和 Windows 10 SDK 应该也会自动启用此功能,但您可以直接执行此操作。

(a) 设置面板 -> 系统 -> 应用和功能 -> 管理可选功能 -> 添加功能 -> Select "Graphics Tools"

(b) 从管理员命令行提示:

Dism /online /add-capability /capabilityname:Tools.Graphics.DirectX~~~~0.0.1.0

this post

Note that when you upgrade from Windows 10 (10240) to the November 2015 update (10586), you may need to re-enable the Graphics Tools optional feature.