1

Sorry if this seems like an obvious question, but I'm just not finding anything online.

In Direct3D9, how do I get the total amount of video memory for a specific display device? I'm looking for a programmatic equivalent of running dxdiag and looking it up there. (I don't care about available memory; just how many MB the video card has.)

Knowing how much memory a user's video card has will be useful information in crash reports.

Walt D
  • 4,491
  • 6
  • 33
  • 43

1 Answers1

3

On Windows Vista, Windows 7, Windows 8.x, and Windows 10, use DXGI. The details are in the DXGI_ADAPTER_DESC structure: DedicatedVideoMemory, DedicatedSystemMemory, SharedSystemMemory.

If you are targeting these operating systems, use should probably be using Direct3D 11 and not legacy Direct3D 9.

See the Video Memory sample from GitHub.

Chuck Walbourn
  • 38,259
  • 2
  • 58
  • 81
  • Is it possible to co-mingle DXGI and DirectX9? Rewriting my thousands of lines of DX9 code in DX11 is out of the question, in my particular case. – Walt D Dec 21 '15 at 04:58
  • Then stick with DirectX 9 but realize debugging on modern versions of the OS is more difficult and you will have to bite the bullet and rewrite it at some point. – Chuck Walbourn Dec 23 '15 at 00:48
  • And yes, you can use DXGI with Direct3D 9 on Windows Vista or later for enumeration and such, but you have you use the legacy APIs to actually create the Direct3D 9 device. – Chuck Walbourn Dec 24 '15 at 08:30