有没有办法在 Windows 7 中使用 DirectX 11?

Is there a way to use DirectX 11 in Windows 7?

我开始尝试在 DirectX 11 中学习编程,但我仍在使用 Windows 7 OS。我的 IDE 是 Visual Studio Community 2019,我尝试创建一个 DirectX 11 项目,但我收到错误消息说我需要将系统升级到 Windows 10 才能使用此功能。我已经下载了 Microsoft Development Kit、SDK 和 VS 提供给我的另一个扩展,我认为它实际上可以工作,但事实并非如此。如果这看起来是个愚蠢的问题,我很抱歉,但我是新手,如果有人能够告诉我我做错了什么,或者如果真的没有其他方法可以编程,我会发现这很有帮助windows 7.

上的 DirectX 11

正如 Simon 在评论中指出的那样,VS 2019 的“DirectX”模板 built-in 仅适用于通用 Windows 平台 (UWP) 应用程序,需要 Windows 10.

我在 GitHub 上为 DirectX 11 和 DirectX 12 维护了一些类似的 UWP 和 Win32 模板。

Windows7支持DirectX 11.0.

Windows 7 可以支持 DirectX 11.1“软件功能”,但不支持 KB2670838. Basically this means you won't get D3D_FEATURE_LEVEL_11_1. See Microsoft Docs 的“硬件功能”。大多数从 Windows Update 更新的 Windows 7 系统都应该有它。

My Win32 templates assume you have DirectX 11.1 these days. For the details on handling DirectX 11.0, see this blog post.

VS 2019 可以支持面向 Windows 7 Service Pack 1 的 Win32 桌面开发。正式 Windows 不支持 7 RTM。

VS 2019 附带 Windows 10 SDK,其中包含基本 Direct3D 11 系统 headers 和库所需的一切。您根本 不需要旧版 DirectX SDK。也就是说,如果您的学习材料仍然引用像 D3DX11 这样的旧东西,您可以安装它,但要注意一些特殊的设置细节。参见 Microsoft Docs

For XAudio2 on Windows 7 SP1, use the XAudio2Redist instead of the legacy DirectX SDK. For XInput, you can use the basic XInput 9.1.0 which is built-in to Windows 7.

You may want to take a look at the DirectX Tool Kit tutorials.