在 Windows 10 上将 D3D11 调试层与 VS2013 一起使用

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

In my D3D 11 projects, I always add

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

到设备创建标志以启用调试输出.自从我升级到 Windows 10 后,这不再起作用.设备创建失败并显示以下输出:

to the device creation flags to enable debug output. Since I upgraded to Windows 10, this does not work any more. The device creation fails with the following output:

D3D11CreateDevice:指定的标志 (0x2) 需要适用于 Windows 10 的 D3D11 SDK 层,但它们不存在于系统中.必须删除这些标志,或者必须安装 Windows 10 SDK.标志包括:D3D11_CREATE_DEVICE_DEBUG

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 调试层吗?

However, I cannot use the Windows 10 SDK nor can I upgrade the project from VS2013 to VS 2015 atm. Is there any way to resolve this issue, ie can I enable the D3D11 debug layer on Windows 10 with VS2013?

推荐答案

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

The debug message is a little misleading. For Windows 10, the Windows SDK no longer installs the Direct3D debug layer. Instead, you need to enable a Windows Optional Feature called "Graphics Tools" which includes the debug layer. Installing VS 2015 and the Windows 10 SDK on Windows 10 should automatically enable this feature as well, but you can do it directly.

(a) 设置面板 -> 系统 -> 应用程序功能 -> 管理可选功能 -> 添加功能 -> 选择图形工具"

(a) Settings panel -> System -> Apps & features -> Manage optional Features -> Add a feature -> Select "Graphics Tools"

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

(b) from a admin command-line prompt:

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

参见 这篇文章.

请注意,当您从 Windows 10 (10240) 升级到 2015 年 11 月更新 (10586) 时,您可能需要重新启用图形工具可选功能.

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.

相关文章