locked
How to detect graphic card model

    Question

  • Hi,

    I want my game can auto detect the running system's graphic card and use it to select the graphic settings. Is there any way to do this in metro apps ?

    Thanks

    Friday, July 20, 2012 2:05 AM

Answers

  • hi,v4vista,you can try this code:

    IDXGIFactory2* pDXGIFactory;
    CreateDXGIFactory1( __uuidof(IDXGIFactory2), (void**)&pDXGIFactory );
    
    IDXGIAdapter1 * pDXGIAdapter;
    
       HRESULT hr = pDXGIFactory->EnumAdapters1( 0, &pDXGIAdapter );
       if( S_OK == hr )
       {
          DXGI_ADAPTER_DESC1 adaptDesc;
          if ( SUCCEEDED( pDXGIAdapter->GetDesc1( &adaptDesc ) ) )
         {
            // now adaptDesc contains the device info
            // you can do what you want
         }
       }
    

    and this is just what Ogre does!
    • Marked as answer by v4vista Wednesday, July 25, 2012 1:52 AM
    Monday, July 23, 2012 3:15 AM

All replies

  • hi,v4vista,you can try this code:

    IDXGIFactory2* pDXGIFactory;
    CreateDXGIFactory1( __uuidof(IDXGIFactory2), (void**)&pDXGIFactory );
    
    IDXGIAdapter1 * pDXGIAdapter;
    
       HRESULT hr = pDXGIFactory->EnumAdapters1( 0, &pDXGIAdapter );
       if( S_OK == hr )
       {
          DXGI_ADAPTER_DESC1 adaptDesc;
          if ( SUCCEEDED( pDXGIAdapter->GetDesc1( &adaptDesc ) ) )
         {
            // now adaptDesc contains the device info
            // you can do what you want
         }
       }
    

    and this is just what Ogre does!
    • Marked as answer by v4vista Wednesday, July 25, 2012 1:52 AM
    Monday, July 23, 2012 3:15 AM
  • Keep in mind that you can't detect the Feature Level supported by an adapter without actually trying to create a device on it. The DXGI_ADAPTER_DESC1 structure doesn't tell you anything about what feature levels it may or may not support.

    Also, for Metro style apps you can rely on the fact that DXGI 1.2 is present and use GetDesc2 and DXGI_ADAPTER_DESC2, although it still doesn't give you any hints about Feature Level.

    Tuesday, July 24, 2012 9:00 PM