Query used VRAM

Hi,

i am looking for a wya to query
the currently used vram.
It is possible ot query the total
vram using kIOFBMemorySizeKey, but
is there any way to get the actual
used/free vram? ( Like the driver monitor does? )

Best,
Hendrik

Yes, but only if you can use GL_ATI_meminfo
http://www.opengl.org/registry/specs/ATI/meminfo.txt

another method is to create a bunch of textures and fill the ram until you get an error, that would give you an aproximate clue on how much is left.

Better than waiting for an error, render small textured quads, and watch the fps : When it goes to less than 5 fps, you can assume textures no longer fits all in GPU ram, but some are pulled from host memory.

You can access these kinds of statistics using the IOKit API.
Search for a device of class IOFramebuffer.
Then the IOAccelTypes property will give you the ACPI path to the corresponding
IOAccelerator driver.
This driver has a PerformanceStatistics dictionary which contains the
information your looking for.

You can take a look at this dictionary using the IORegistryExplorer application
searching for “display” devices in the IOService plane.

Actually, you want “accelerator” in IORegistryExplorer, not “display”.

You can use IOKit to query “vramUsed” use and other statistics just like driver monitor, but keep in mind those are per-driver stats, not per-app. You’re seeing a view of the entire system, with all applications simultaneously competing for the same VRAM.