Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do you query the amount of VRAM available when using DirectX?

share|improve this question
up vote 7 down vote accepted

According to Game Coding Complete 3, there are a few ways:

  • DX7's GetAvailableVidMem() - usually pretty good. Doesn't work too well on cards with shared memory.
  • WMI (Windows Management Interface) has a similar result to the above.
  • DxDiag uses both to give a better result.
  • D3D9 has a GetAvailableTextureMemory() function, but can only be used on Windows Vista/7.

Look for a DX sample in March 08 or later SDK called 'VideoMemory'.

share|improve this answer
DX Sample for Video Memory is great -- should have found that before asking ;) – Vincent Scheib Oct 8 '10 at 17:38
Considering how many computers will use shared memory, I would not recommend DX7's version. And how can the D3D9 version of this be only available on Vista+ ? D3D9 was there in XP... – Bahbar Oct 12 '10 at 20:57

For DX9EX on Vista and later:

IDXGIDevice * pDXGIDevice;
hr = g_pd3dDevice->QueryInterface(__uuidof(IDXGIDevice), (void **)&pDXGIDevice);
IDXGIAdapter * pDXGIAdapter;
return adapterDesc.DedicatedVideoMemory;

(from )

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.