API for graphics or video memory

I want to get RAM-memory or graphic RAM, which you can see in the settings screen or device manager using the API. I am in a C ++ application.

I tried surfing the net, and in my RnD I came to the conclusion that we can get graphics memory information from 1. DirectX SDK structure called DXGI_ADAPTER_DESC. But what if I do not want to use the DirectX API. 2. Win32_videocontroller: But this class does not always give you adapterRAM information if the availability of the video controller is disabled. I tested it on Vista.

Is there any other way to get graphic RAM?

+5
source share
3 answers

, , , .

DirectX. , . , , . , , . "swizzled" , , . , , .

, Windows/DirectX . D3D1x Im , IDXGIOutput. , , ...

win32 ( C), .

.

    unsigned int* pBits = malloc( width * height );

DC.

    HBITMAP hBitmap = ::CreateBitmap( width, height, 1, 32, NULL );
    SelectObject( hDC, (HGDIOBJ)hBitmap );

pBits, . , -.

    ::SetBitmapBits( hBitmap, width * height * 4, (void*)pBits )

, ( DeleteObject) !

: , DX Diag. IDxDiagProvider IDxDiagContainer DX SDK.

+3

Win32_videocontroller - gfx. Doom3.

: " . Vista". ?

, Doom3 . , , Sys_GetVideoRam, win_shared.cpp, , , .

+2

-, , . , ? , : LOT . 32- RGBA ARGB. 15/16/24- (RGBA555, RGBA5551, RGBA4444, RGBA565, RGBA888...). , (), YUV.

, / API- .

If you want to write to the display surface (which is not exactly equal to the framebuffer memory, although conceptually almost the same), there are many options. DX, Win32, or you can try the SDL library (libsdl).

+1
source

All Articles