본문 바로가기

오래된 흔적/GPU

[DX] Video Memory Sampple

Applications often need to know how much video memory is available on the system. This is often used to scale content to ensure that it fits in the allotted video memory without having to page from disk.

Video Memory Classifications

Video memory can fall into one of two buckets. The first is dedicated video memory. Dedicated video memory is available for exclusive use by the video hardware. Dedicated video memory typically has very fast communication with the video hardware. It can also be referred to as "on-board" or local video memory because the memory can often be found on the video card. Integrated video cards often do not have dedicated video memory.

The second type of video memory is shared system memory. Shared system memory is memory that is already part of the system memory. The video hardware can use this memory the same as it would dedicated video memory, but so can the operating system and other applications. For discrete video cards, this can also be called non-local video memory. Integrated video cards often only have shared system memory. Shared system memory will usually have slower communication with the video hardware than dedicated video memory.

Ways to Get Video Memory

There are several ways to get the video memory size on a system. This sample demonstrates 5 methods. The first 4 are available on Windows XP or later, while DXGI is only available on Windows Vista or later.

  • GetVideoMemoryViaDirectDraw: This method queries the DirectDraw 7 interfaces for the amount of available video memory. On a discrete video card, this is often close to the amount of dedicated video memory and usually does not take into account the amount of shared system memory.
  • GetVideoMemoryViaWMI: This method queries the Windows Management Instrumentation (WMI) interfaces to determine the amount of video memory. On a discrete video card, this is often close to the amount of dedicated video memory and usually does not take into account the amount of shared system memory.
  • GetVideoMemoryViaDxDiag: DxDiag internally uses both DirectDraw 7 and WMI and returns the rounded WMI value if WMI is available. Otherwise, it returns a rounded DirectDraw 7 value.
  • GetVideoMemoryViaD3D9: This method queries D3D9 for the amount of available texture memory. On Windows Vista, this number is typically the dedicated video memory plus the shared system memory minus the amount of memory in use by textures and render targets.
  • GetVideoMemoryViaDXGI: DXGI is only available on Windows Vista or later. This method returns the amount of dedicated video memory, the amount of dedicated system memory, and the amount of shared system memory. DXGI is more reflective of the true system configuration than the previous 4 methods.

Best Practices

On Windows Vista or later, DXGI should always be used to query the available video memory.

On Windows XP, the WMI is a good choice however it should be noted that integrated video cards often only have shared system memory so the number should be used with caution to avoid compatibility problems with integrated video cards.


'오래된 흔적 > GPU' 카테고리의 다른 글

그래픽 카드별 사양 수준 설정하기  (0) 2009.07.21
내 노트북 그래픽 카드에 관하여..  (0) 2009.06.12
Video Card  (0) 2009.06.10
PNG vs DDS 그것이 문제로다..  (0) 2009.05.13
NVIDIA Shader Debugger  (0) 2009.05.11