Get the graphics card model?

后端 未结 5 1603
猫巷女王i
猫巷女王i 2020-12-07 01:18

I was wondering how I can get the graphics card model/brand from code particularly from DirectX 9.0c (from within C++ code).

相关标签:
5条回答
  • 2020-12-07 01:30

    Take a look at Chapter 2. Direct3D from my book The Direct3D Graphics Pipeline. See section 2.12, Identifying a Particular Device.

    0 讨论(0)
  • 2020-12-07 01:32

    You can use "DirecX Diagnostic Tool" API, like in sample DxDiagOutput from DX SDK http://msdn.microsoft.com/en-us/library/ee416986%28v=VS.85%29.aspx

    0 讨论(0)
  • 2020-12-07 01:32
    IDirect3D9* d3dobject = Direct3DCreate9(D3D_SDK_VERSION);
    D3DPRESENT_PARAMETERS d3dpresent;
    memset(&d3dpresent, 0, sizeof(D3DPRESENT_PARAMETERS));
    d3dpresent.Windowed = TRUE;
    d3dpresent.SwapEffect = D3DSWAPEFFECT_DISCARD;
    UINT adaptercount = d3dobject->GetAdapterCount();
    D3DADAPTER_IDENTIFIER9* adapters = (D3DADAPTER_IDENTIFIER9*)malloc(sizeof(D3DADAPTER_IDENTIFIER9) * adaptercount);
    
    for (int i = 0; i < adaptercount; i++)
    {
          d3dobject->GetAdapterIdentifier(i, 0, &(adapters[i]));
    }
    

    Then get the description of adapters (adapters->Description)

    0 讨论(0)
  • 2020-12-07 01:43

    The easiest way in DirectX is through IDirect3D9::GetAdapterIdentifier.

    Just create a D3DADAPTER_IDENTIFIER9 object, pass a pointer to it to GetAdapterIdentifier. DirectX fills out the graphics card description as a string in the Description field. It also includes information on which display device the card is, and what driver version you have.

    You get something like this:

    • Description: "NVIDIA GeForce GTX 570"
    • Device: "\.\DISPLAY1"
    • Driver: "nvd3dum.dll"
    0 讨论(0)
  • 2020-12-07 01:47

    At runtime, you can query the device model and vendor:

    • In OpenGL, use the command glGetString(GL_VENDOR) or GL_RENDERER or GL_VERSION to get the information you're after.

    • In DirectX 9, it appears the info is in the Microsoft config system, and is queried from the device database. It's section 3 of this document, which also has example code: http://msdn.microsoft.com/en-us/library/bb204848(VS.85).aspx Using the same system you can get such information as the amount of ram the video card has, the driver number, etc.

    0 讨论(0)
提交回复
热议问题