Distinguishing shared vs. dedicated VRAM

I can use CGL APIs to find the total amount of graphics memory available to a display, but it doesn’t distinguish between real VRAM and graphics memory shared with the CPU. Somehow the System Profiler can tell the difference. Anyone know how?

Hi James,

I thought Chris et al in the OpenGL list had covered this for you…

But there is another thread here where we discuss some of the same stuff…
http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=258022#Post258022

Not unless I missed something. The CGL method that I mentioned here (CGLDescribeRenderer and such) definitely does not distinguish VRAM from shared memory. There’s also an IOKit approach, which is incorrect in the Apple Q&A, and Chris said it could be fixed, but didn’t say how.

I’m not sure (no code is given in that thread, and IOKit is fairly opaque to me), but I’ll bet that approach also treats shared memory the same as VRAM.

For the record, I found a somewhat suboptimal solution: Run the command

system_profiler -detailLevel mini -xml

in an NSTask, and then parse the result. I say “suboptimal” because it may take a couple of seconds.

That’s useful to know. :slight_smile:

Here’s a way to achieve this :
http://developer.apple.com/samplecode/VideoHardwareInfo/listing3.html

look at function interrogateIOKitFor

That function fails to distinguish between shared and dedicated VRAM. I tried the VideoHardwareInfo app on a Mac mini that, according to System Profiler, has 64 MB of shared memory. It reports 256 MB of VRAM.

Any time you have a function that reports a single value for graphics memory, I think it’s likely that it doesn’t distinguish shared and dedicated VRAM.

I don’t doubt that there’s some way to get the information from IOKit, but apparently this isn’t it.

Ok. Good to know. On another thread (Get amount of graphics memory in OpenGL coding: advanced), I’ve read that WBEM is developed as an open source project for MAC OS and Linux. May be it worth taking a look to it as it can provides a lot of system infos.