2011年12月29日 星期四

How to get video memory size

From the MSDN http://msdn.microsoft.com/en-us/library/ee419018(v=vs.85).aspx, there are several ways to get the size of video memory on a system. This sample demonstrates 5 methods. The first 4 are available on Windows XP, Windows Vista, and Windows 7, while DirectX Graphics Infrastructure (DXGI) is only available on Windows Vista and Windows 7. Those methods are:
GetVideoMemoryViaDirectDraw
GetVideoMemoryViaWMI
GetVideoMemoryViaDxDiag
GetVideoMemoryViaD3D9
GetVideoMemoryViaDXGI

On Windows Vista and Windows 7, use DXGI to query the available video memory.
On Windows XP, WMI is a good choice—however, note that integrated video cards often have only shared system memory, and WMI does not distinguish between dedicated and shared memory. So, the returned size should be used with caution to avoid compatibility problems when a system has integrated video hardware.

There is the Microsoft Direct X SDK VideoMemory sample code can be reference.  We can find the run result.

D3D9 Adapter: 0
Driver: atiu9pag.dll
Description: ATI Mobility Radeon HD 5450
hMonitor: 0x00010001
hMonitor Device Name: \\.\DISPLAY3
        GetVideoMemoryViaDirectDraw
                dwAvailableVidMem: 504 MB (529022976)
        GetVideoMemoryViaDxDiag
                dwDisplayMemory: 1715 MB (1798307840)
        GetVideoMemoryViaWMI
                dwAdapterRAM: 512 MB (536870912)
        GetVideoMemoryViaDXGI
                DedicatedVideoMemory: 504 MB (529022976)
                DedicatedSystemMemory: 0 MB (0)
                SharedSystemMemory: 1210 MB (1269751808)
        GetVideoMemoryViaD3D9
                dwAvailableTextureMem: 1714 MB (1797259264)

The DedicatedVideoMemory of GetVideoMemoryViaDXGI result is 504MB seems smaller than the actual size.  The GetVideoMemoryViaWMI result seem more correct.

There is one similar document talk about this in the Vista OS -- http://support.microsoft.com/kb/938838/en-us

Windows Vista displays the incorrect dedicated video memory size for certain display adapters


Below show you how to check the video memory size in the Windows.

















沒有留言:

張貼留言