Does anyone know if GetAvailableTextureMem returns the available memory on the video card, or is it ALL available memory? I did a check with a 32 meg video card, and it told me I had 92274688 megs of available texture memory. 90 Gigs happens to be my hard drives total storage, is this where it's getting that huge number from? Is there a way to find out how much memory is on the video card then? I didn't see it listed in the caps and I couldnt find it in the docs or on google, but maybe I missed it? I know there is a function in direct draw7, but do I really have to set up Direct draw just to find this out? It seems like it should be in D3D. Thanks.
Posted on 2002-07-28 12:02:02 by AlexEiffel
It should be in D3D but it seems to me GetAvailableTextureMem on DirectX8 interface is "kinda buggy". I've heard it also includes your system memory and the video memory. Even if it succeeds, It might not really give you the exact video memory but an approximation of it.

I wonder how DirectX Diagnostics get those exact results. Or maybe, I just used the method incorrectly, maybe there are some intial steps to do before calling GetAvailableTextureMem. I don't know, I have no idea. :(
Posted on 2002-08-04 15:51:06 by stryker
Anyway, here are some codes I found
LPDIRECTDRAW7 lpDD7; 


DDSCAPS2 ddsCaps2;

DWORD total_memory_for_textures;

DWORD free_memory_for_textures;

DWORD total_video_memory;

DWORD free_video_memory;

HRESULT hr;



// Query Direct Draw, and gain access so we can get info. pDD is a pointer to a valid

// LPDIRECTDRAW7 structure that has already been setup and initalised.

hr = pDD->QueryInterface(IID_IDirectDraw7, (void **)&lpDD7);



// Get total and available video and / or system memory for textures

// Initialize the structure.

ZeroMemory(&ddsCaps2, sizeof(ddsCaps2));

// Set caps to indicate we want to know about texture memory

ddsCaps2.dwCaps = DDSCAPS_TEXTURE;

// The GetAvailableVidMem function if sucessful will put the total amount of video + system memory

// that DirectX can use for textures in total_memory_for_textures, and will put the total - used amount in

// free_memory_for_textures.

hr = pDD->GetAvailableVidMem(&ddsCaps2, &total_memory_for_textures, &free_memory_for_textures);



// Get total and available video memory for Direct Draw

// Initialize the structure.

ZeroMemory(&ddsCaps2, sizeof(ddsCaps2));

// Set caps to indicate we want to know about video memory

ddsCaps2.dwCaps = DDSCAPS_VIDEOMEMORY ;

// The GetAvailableVidMem function if sucessful will put the total amount of video memory

// that DirectX can use for anything in total_memory_for_textures, and will put the total - used amount in

// free_memory_for_textures.

hr = pDD->GetAvailableVidMem(&ddsCaps2, &total_video_memory, &free_video_memory);
I haven't tested these.
Posted on 2002-08-04 16:39:30 by stryker
Hey stryker, thanks for trying to help. I've actually already tested the method you mentioned. On my machine, it returns about 29 megs which is a lot closer, but still not the 32 that my card is rated for. I've been posting on boards everywhere and asking some of my coworkers as well, but no one seems to know how to get the right amount.
Posted on 2002-08-04 16:47:04 by AlexEiffel
It's 29 because windows uses some of the memory but it still bothers me how DX Diagnostics can get accurate results which is 32 mb in my case???

Maybe MS uses some sort of a way to directly communicate the video card ... just my speculations. :)
Posted on 2002-08-04 16:58:10 by stryker