无接口:ID3D12Device2

No Interface : ID3D12Device2

if (FAILED(hr = D3D12CreateDevice(NULL, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(p_ppD3D12Device2))))
{
    // hr = nointerface  
}

查看MS文档后,我知道问题可能可以通过更新windows来解决。

GPU:Nvidia Quadro P4000

OS: Windows 2016 Server

但是我有几个问题。

  1. 这意味着某些使用 ID3D12Device2 的游戏无法在某些 Win10 PC 上运行。

  2. 我需要申请哪个版本windows更新? (我不想更新不相关的东西。)

  3. ID3D12Device2 、3、 4代替ID3D12Device有什么好处?

"Windows 2016 Server" 相当于 Windows 10 周年更新 (14393)。因此,该版本的 Windows 将支持 ID3D12DeviceID3D12Device1 接口,但不会更新。

如果您升级到“Windows 2016 Server,版本 1709”,那么它相当于 Windows 10 Fall Creators Update (16299),支持 ID3D12DeviceID3D12Device1ID3D12Device2ID3D12Device3.

PC 游戏使用他们认为需要支持其标题的 Windows10OS 版本支持的任何设备版本。如果他们想支持旧版本的 Windows,那么他们会使用他们想要的最旧的界面(通常 ID3D12Device 对于大多数基本图形来说都很好),然后使用 QueryInterface 来条件测试新的如果他们使用它,请支持。如果他们想 运行 没有该功能,他们将需要后备代码路径。

ComPtr<ID3D12Device> device;
if (FAILED(hr = D3D12CreateDevice(NULL, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&device))))
{
    // Not on Windows 10 or the is no default video device that supports DirectX 12
}

...

ComPtr<ID3D12Device2> device2;
hr = device.As(device2);
if (SUCCEEDED(hr))
{
    // This system supports DirectX 12.2
}

大多数较新版本的设备都公开了新功能,您必须首先通过 ID3D12Device::CheckFeatureSupport 检查这些功能,以确认 driver 确实支持当前硬件上的新功能,因此仅检查接口版本是不够的。

有关各种 'optional' 功能的更多信息,请参阅 SystemInfo and DxCapsViewer

Windows 10 does not ship 'new features' via Windows Update piecemeal. They are shipped as part of newer versions of the OS. If you were using Windows Server 2019 which is the equivalent to Windows 10 October 2018 Update (17763) you would have support up through ID3D12Device4 which supports DirectX Raytracing with proper hardware. There's not yet a release of Windows Server that provides ID3D12Device8 (Amplification & Mesh Shader, DirectX Raytracing 1.1, Variable Rate Shaders) support that shipped in Windows 10 May 2020 (19041). Remember DirectX 12 is considered a 'consumer feature'.

说了这么多,你不需要ID3D12Device2支持来学习 DirectX 12。该接口公开的方法,CreatePipelineState,创建来自 D3D12_PIPELINE_STATE_STREAM_DESC 的管道状态 Object (PSO)。这用于高级着色器场景,如放大和网格着色器,但您不必使用它。例如,所有 DirectX Tool Kit for DX12 都适用于基础 ID3D12Device 接口。

一个更大的问题是您可能没有支持 DirectX 12 的视频卡 driver。有关创建 DirectX 12 设备的推荐方法,请参阅 Anatomy of Direct3D 12 Create Device

BTW, D3D12CreateDevice supports being able to directly create newer versions of the interface for cases where you already know the target platform supports it. For example, using DirectX 12 on Xbox or if you are a UWP/Desktop Bridge app that has a particular version of Windows 10 set as the minimum supported OS.