C++ - Obtain GPU Info

Discussion in 'Mac Programming' started by Aztral, Apr 4, 2012.

  1. macrumors newbie

    Apr 4, 2012
    I'm needing to query various data on the GPU, for example total dedicated video memory, driver names, driver versions and ideally driver dates. I'm programming in C++ using the IOKit library to do so.

    For example, I can get total dedicated video memory by iterating over IOService IOPCIDevice entries, looking for a device with "IOName" set to "display", checking if it has a "VRAM,totalsize" property and if so pulling out that data. This seems reasonably reliable, but is it guaranteed? For example, on my machine this display entry has a property "IOOCDBundleName" which seems to indicate the driver name "ATIRadeonX3000GLDriver". Can I count on this entry always having an IOOCDBundleName property? For both ATI and NVIDIA cards? Are any particular properties guaranteed to be the same across different cards and card vendors?

    Also, is there any way to obtain the date a driver was created? I can do this in the Windows registry but there doesn't seem to see a similar value on OS X. On Windows the DriverDate seems to correspond to the date that the actual driver file was created. Is it safe to make the same assumption on OS X? (i.e. is looking at the modification date for the actual executable found in the bundle previously specified a reliable way to get the date for the driver?)

    I'm rather new to using the IOKit library, and I'd just like to make sure that my methods for grabbing data aren't going to break when run on potentially different hardware. Thanks for any info.

Share This Page