Dxgi can obtain the exact size of the video memory. However, because dxgi is based on wddm, it is necessary to determine whether the display driver model of the current system is wddm.
Haswddmdriver ()
{
Lpdirect3dcreate9ex pd3d9create9ex = NULL;
Hmodule hd3d9 = NULL;
Hd3d9 = loadlibrary (L"D3d9. dll");
If (null = hd3d9) {
return false ;
}
//
/*Try to create idirect3d9ex interface (also known as a dx9l interface). This interface can only be created if the driver is a wddm driver.
*/
//
Pd3d9create9ex = (lpdirect3dcreate9ex) getprocaddress (hd3d9,"Direct3dcreate9ex");
ReturnPd3d9create9ex! = NULL;
}
Then, access getdesc of the adapter to obtain a dxgi_adapter_desc struct, which stores the graphics card information.
Idxgidevice * pdxgidevice;
HR = g_pd3ddevice-> QueryInterface (_ uuidof (idxgidevice ),( Void **) & Pdxgidevice );
Idxgiadapter * pdxgiadapter;
Pdxgidevice-> getadapter (& pdxgiadapter );
Dxgi_adapter_desc adapterdesc;
Pdxgiadapter-> getdesc (& adapterdesc );