Use dxgi to obtain the precise memory size

Source: Internet
Author: User

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 );

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.