Ralf's profileFun with GPUsBlogLists Tools Help

Blog


    March 30

    How to check if a graphics adapter supports Direct3D 10?

    In comparison to Direct3D 9 there is no general object for hardware enumeration in Direct3D 10. But Vista supports another API for this purpose. DirectX Graphics Infrastructure (DXGI) is the way to go. This short example shows how to use DXGI to look for a Direct3D 10 compatible graphics adapter.

         IDXGIFactory* pDXGIFactory; 

          HRESULT hr = CreateDXGIFactory (__uuidof(IDXGIFactory), (void**)&pDXGIFactory);

          if (hr != S_OK) 
                return -1;

          int AdapterIndex = 0;

          IDXGIAdapter* pAdapter;

          // Loop as long as DXGI returns valid adapters.

          while (pDXGIFactory->EnumAdapters (AdapterIndex, &pAdapter) == S_OK) 
          { 
                DXGI_ADAPTER_DESC AdapterDesc; 

               
    if (pAdapter->GetDesc (&AdapterDesc) != S_OK)
     
                      continue; 

                std::wcout << L"Name:                    " << AdapterDesc.Description << "\n\r"; 
                std::wcout << L"D3D10 support:           "; 

               
    LARGE_INTEGER version;
     

                if (pAdapter->CheckInterfaceSupport (__uuidof (ID3D10Device), &version) != S_OK)
                      std::wcout << L"NO\n\r"; 
                else 
                      std::wcout << L"YES\n\r"; 

                pAdapter->Release (); // Don't forget to release when you are done 
                AdapterIndex++; 
          } 

          pDXGIFactory->Release ();

    Be aware that the key method CheckInterfaceSupport will not work with interface GUIDs of older Direct3D version.