Video Memory

BlitzMax Forums/BlitzMax Programming/Video Memory

Zeke(Posted 2007) [#1]
Hi im new blitzmax user, but i know how to get free video memory/total video memory.

Graphics 800,600

Local totalmem:Int
Local freemem:Int

Local mycaps:DDCAPS_DX7=New DDCAPS_DX7

mycaps.dwCaps=DDSCAPS_VIDEOMEMORY'|LOCALVIDMEM|NONLOCALVIDMEM|SYSTEMMEMORY

local err:int=d3d7graphicsdriver().DirectDraw7().GetAvailableVidMem(MyCaps,Varptr totalmem,Varptr freemem)

Print "Total Video Memory : "+totalmem
Print "Free Video Memory  : "+freemem


^^ that memory is GFX card memory + BIOS AGP Aperture size..

-Mystic Coder-


JazzieB(Posted 2007) [#2]
Something's not quite right there, because I get the following...

Total Video Memory : 534118400
Free Video Memory : 532132864

About 521,600KB of total video memory on my 512KB card!

EDIT - Oops! Must have been having one of those days. Still works out to 509MB for total though (dividing by 1024 twice). Not sure if that's normal.


Zeke(Posted 2007) [#3]
You mean 512Mb card? i have Ati Radeon X1600 256MB Ram and in BIOS 64 Mb (aperture size) and i get about 320Mb. total video memory.


TaskMaster(Posted 2007) [#4]
512MB is 536870912 bytes.

There is 1024 bytes in a KB, and 1024 KB in a MB.

So 512MB * 1024KB * 1024 bytes


ImaginaryHuman(Posted 2007) [#5]
pc only though


plash(Posted 2007) [#6]
its just rounded off to the nearest x64 number


Dreamora(Posted 2007) [#7]
it works on all systems having DX

OpenGL has no texture management and thus no reliable way to return the used memory


Grey Alien(Posted 2007) [#8]
It says I have 370MB VRAM even though My Radeon 9800XT only has 256MB RAm. Also it says I have a 2% load no matter what textures my game loads onto it...


Tachyon(Posted 2007) [#9]
Doesn't work at all for me... :( It just says:

Total Video Memory : 0
Free Video Memory : 0

WinXP, AMD64-FX60, GeForce 7900GTX, all drivers and such up-to-date.


tonyg(Posted 2007) [#10]
This has been discussed before and it was believed the same API was used by B3D for AvailVidMem which also
produced some inaccurate responses.
Mark explained it was the video card returning dodgy information rather than an API issue


MGE(Posted 2007) [#11]
Yep, this is un-reliable data, don't bank on it. ;) For casual game development just keep a goal of no more than 64mb (32mb even better!) of video memory usage. (textures, stc.) And remember, 32bit screens double your video memory requirements.


Dreamora(Posted 2007) [#12]
Gray: You forget the fact that Catalyst 6 upwards have software hypermemory which assigns another 128MB (or even more) of system RAM to the "texture memory block" of the graphic card.


Grey Alien(Posted 2007) [#13]
Tony: Yeah i recall hearing it was inaccurate. Zeke kindly sent me this for my framework but after I tested it I had to put a comment in saying take the results with a pinch of salt.

MGE Developer: Yeah basically each pixel must be assumed to be 4 bytes. So a 260,260 texture becomes 512x512 then x4 = 1MB.

Dreamora: I didn't foget, I didn't even know! ;-) It's assigning a funny value on my system them as 370 - 256 = 114 and the used amount never changes realistically...


xlsior(Posted 2007) [#14]
Mine shows:

Total Video Memory : 526352320
Free Video Memory : 513920960

on a 256MB ATI X1650XT...