Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / Game Design & Programming / query card's memory size Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
clunis

March 07, 2005, 10:18 AM

Greetings,

I am trying to use DirectX to query available video memory.
These are the numbers I get:

For my 256MB GeForce 6800:
GetAvailableVidMem: total = 256901120 free = 256852992
AvailableTextureMem = 448790528
That seems OK.

But, for my 128MB ATI FireGL3100 card:
GetAvailableVidMem: total =
654180320 free = 654180320
GetAvailableTextureMem(): 654311424
That's around 624 MB!

I am only interested in knowing whether the card is a 64/128/256 model. I don't care how much is available for use etc.

thanks,
Maniam

My code:
------
LPDIRECTDRAW lpdd = NULL;
LPDIRECTDRAW7 lpdd7 = NULL;
DDSCAPS2 ddsCaps2;
DWORD dwTotal;
DWORD dwFree;
HRESULT hr;

ZeroMemory(&ddsCaps2, sizeof(ddsCaps2));
ddsCaps2.dwCaps = DDSCAPS_OFFSCREENPLAIN;
hr = lpdd7->GetAvailableVidMem(&ddsCaps2, &dwTotal, &dwFree);

g_pD3D = Direct3DCreate9(D3D_SDK_VERSION);
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp, sizeof(d3dpp) );
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;

if( FAILED( g_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &g_pd3dDevice ) ) )
{
return E_FAIL;
}

DDSCAPS2 ddsVidMemcaps;
ZeroMemory(&ddsVidMemcaps, sizeof(DDSCAPS2));
ddsVidMemcaps.dwCaps = DDSCAPS_VIDEOMEMORY;
int AvailableTextureMem = g_pd3dDevice->GetAvailableTextureMem();

 
Nutter

March 07, 2005, 11:02 AM

Have a look into the DXDiag interfaces - they do what you want. In the latest NV SDK there's a sample app that does this exact thing.

*edit: err.. I just remembered that the "latest SDK" isn't publicly available yet, and I can't remember if the previous version has the example (quite likely though). If it doesn't, NVSDK 9 should be out very soon.

 
This thread contains 2 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.