views:

84

answers:

2

I'd like to be able to detect how much graphics memory is available. I've written a C++ project that uses DirectShow.

Some ancient gfx cards can't do video properly and fall back to four colour mode. If I try to allocate more than one video window, the program just crashes on these machines without warning.

This is less than elegant, and I'd like to detect available graphics memory ahead of time, so I can determine if the program has enough gfx mem to run.

A: 

8mb. IIRC this is the maximum amount according to the AGP standard. All the extra memory on the gfx card was there to buffer the main memory so it didn't have to go across the bus.

I'd be surprised if the standard hadn't been revised.

If you have really old gfx cards to work with you can try looking at the Video Bios Extensions (VBE). That has a method for querying memory.

graham.reeds
Not all graphics cards talk through an AGP bus. Potentially a customer could have any kind of graphics solution - a PCI gfx card, an integrated graphics chip on the mobo, or the more recent cards that use the PCIe bus.I'm looking for the methods to determine the graphics card solution, and the facility to determine how much discrete and shared memory the GPU has at its disposal. I'd really like to get the number - how much gfx memory is my application using?I'm aware that there is an API for Vista and later (WVDDM) That allows you to query graphics memory. What about WinXP though ...?
freefallr
Well CPU-Z definately reports how much memory is on my gfx card. As for how it does it...
graham.reeds
+2  A: 

A really sneaky way that should work on XP and lower is to read the registry:

For example, I access \HKLM\Hardware\Devicemap\Video and get a GUID: {3468769C-3D6B-4BB1-85B6-7B5AE7F4E8F8}

Then I access \HKLM\CCS\Control\Video, and read "HardwareInformation.MemorySize" for that device:

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Video{3468769C-3D6B-4BB1-85B6-7B5AE7F4E8F8}

A much better approach (the recommended approach, in fact) is to use WMI:

GetVideoMemoryViaWMI

great, thanks Paulsm!
freefallr