CreateDXGIFactory 是否始终创建最新版本的 IDXGIFactory 系统支持?

Is CreateDXGIFactory always create the newest version of IDXGIFactory system support?

我用CreateDXGIFactory创建了一个IDXGIFactory(最旧的版本),然后用这个IDXGIFactory查询IDXGIFactory6,成功了。(我的系统版本是Win10 1803)

1.So,这个函数CreateDXGIFactory总是创建系统支持的最新版本的IDXGIFactory吗?

类似的东西,D3D11CreateDevice创建ID3D11Device的基础版本,我可以成功查询ID3D11Device3吗?

2.The第二个问题,函数D3D11CreateDevice是创建系统支持的ID3D11Device的最新版本吗?

D3D11CreateDevice 更简单,因为它是一个入口点。该文档不使用术语 "older version" 和 "newer version"。相反,它建议 API 创建一个具有请求接口的对象,这对您所在的系统和请求的创建参数(功能级别等)来说是足够的。之后,您可以通过查询更新的接口来访问更新的功能(如果可用),文档也建议这样做:

To create a Direct3D 11.1 device (ID3D11Device1), which is available on Windows 8, Windows Server 2012, and Windows 7 and Windows Server 2008 R2 with the Platform Update for Windows 7 installed, you first create a ID3D11Device with this function, and then call the QueryInterface method on the ID3D11Device object to obtain the ID3D11Device1 interface.

To create a Direct3D 11.2 device (ID3D11Device2), which is available on Windows 8.1 and Windows Server 2012 R2, you first create a ID3D11Device with this function, and then call the QueryInterface method on the ID3D11Device object to obtain the ID3D11Device2 interface.

也就是说,您开始以相同的方式创建设备,然后查询新接口。实现可能会或可能不会通过升级到 "newer implementation" 来响应,具体取决于您是否曾经查询过这些新接口。无论哪种方式,它仍然是特定于实现的,包括这种行为可以在技术上改变,只要它以这种记录的方式对使用 API 的应用程序透明。

DXGI 有两个 API 入口点 CreateDXGIFactoryCreateDXGIFactory1。该文档建议您不要通过 1.0 和 1.1 接口混合使用 API。

Do not mix the use of DXGI 1.0 (IDXGIFactory) and DXGI 1.1 (IDXGIFactory1) in an application. Use IDXGIFactory or IDXGIFactory1, but not both in an application.

这并不一定意味着这两个函数正在创建不同的工厂。只要您遵守记录的指南,Microsoft 保留调整行为的权利。

如果您不打算做任何超出 DGXI 1.0 的事情,您可以在旧系统和新系统上使用 CreateDXGIFactory。如果您需要 1.1 及更高版本的功能,您应该从 CreateDXGIFactory1 开始。另请注意,这两个功能在不同环境中具有不同的可用性,这是它们首先存在的原因之一。