c++ - IDXGISwapChain::CheckInterfaceSupport 返回的结果不能

标签 c++ c++11 directx directx-11

根据IDXGIAdapter::CheckInterfaceSupport documentation如果支持传入的接口(interface),则返回 S_OK,否则返回 DXGI_ERROR_UNSUPPORTED。代码片段:

for( size_t i = 0; i < GInterface::m_Adapters.size(); i++)
{
    hr = GInterface::m_Adapters.at(i)->CheckInterfaceSupport(__uuidof(ID3D11Device), (LARGE_INTEGER*)&umdVersion);
    printf( "***D3D11 %sSUPPORTED FOR ADAPTER %d (%d)",
            (hr != DXGI_ERROR_UNSUPPORTED) ? "" : "NOT ",
            i,
            umdVersion);
}

控制台始终打印NOT,但如果我更改为__uuidof(ID3D10Device),则不会。
但我绝对知道我的 GPU 支持 DirectX11,因为:

  1. 我目前正在编写的程序正在使用 DirectX 11 并且它正在运行
  2. 我的 GPU:GTX 970,不是最新的,但是......应该支持 D3D11 :D

请有人把事情弄清楚我有点恼火,谢谢。

最佳答案

IDXGIAdapter:CheckInterfaceSupport 的“备注”部分(强调我的):

Note You can use CheckInterfaceSupport only to check whether a Direct3D 10.x interface is supported, and only on Windows Vista SP1 and later versions of the operating system. If you try to use CheckInterfaceSupport to check whether a Direct3D 11.x and later version interface is supported, CheckInterfaceSupport returns DXGI_ERROR_UNSUPPORTED. Therefore, do not use CheckInterfaceSupport. Instead, to verify whether the operating system supports a particular interface, try to create the interface. For example, if you call the ID3D11Device::CreateBlendState method and it fails, the operating system does not support the ID3D11BlendState interface.

关于c++ - IDXGISwapChain::CheckInterfaceSupport 返回的结果不能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42615225/

相关文章:

c++ - 我正在尝试将像素数据转换为 OpenCV Mat 对象

c++ - 如何获取使用 hash_map 构建的旧 C++ 代码?

c++ - 为什么当我尝试重写指向 Direct3D 设备的 `EndScene` 函数的指针时什么也没有发生?

c++ - 将 D3DFMT_UNKNOWN 传递到 IDirect3DDevice9::CreateTexture()

c++ - 排序可视化——如何解决循环依赖?

c++ - 为什么必须包含 <initializer_list> 才能使用 auto?

c++ - 使用 boost 在 C++-11 中封装随机数生成器

c++ - 为什么我的 for 循环永远不会结束?

installation - 如何在安静模式下安装 DirectX?

c++ - 右值、左值和正式定义