顯示具有 graphics 標籤的文章。 顯示所有文章
顯示具有 graphics 標籤的文章。 顯示所有文章

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.

















2011年12月28日 星期三

DWM


Desktop Window Manager

The desktop composition feature, introduced in Windows Vista, fundamentally changed the way applications display pixels on the screen. When desktop composition is enabled, individual windows no longer draw directly to the screen or primary display device as they did in previous versions of Windows. Instead, their drawing is redirected to off-screen surfaces in video memory, which are then rendered into a desktop image and presented on the display.
Desktop composition is performed by the Desktop Window Manager (DWM). Through desktop composition, DWM enables visual effects on the desktop as well as various features such as glass window frames, 3-D window transition animations, Windows Flip and Windows Flip3D, and high resolution support.
The Desktop Window Manager in Windows 7 includes some registry keys.
HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM