Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » [A5] Detecting Available Video Memory

This thread is locked; no one can reply to it. rss feed Print
[A5] Detecting Available Video Memory
Kris Asick
Member #1,424
July 2001

Very simple question: How do I detect how much video memory is available, either overall or currently free?

I'm trying to keep my current project from exceeding 256 MB of video memory, but I'm already past the halfway mark and while I can estimate roughly how much video memory I'm using based on my texture sizes (it's about 160 MB at the moment, including reserved space for graphics I'll be adding later) I don't know enough about video memory allocation to know exactly how much is available to use for whatever purposes and I'm worried I might get dangerously close to exceeding 256 MB when all is said and done.

Also, is there a way to automagically load a bitmap into Allegro at reduced size, or do you have to load the full size image first, then manually scale it into a pre-existing reduced-size ALLEGRO_BITMAP?

--- Kris Asick (Gemini)
--- http://www.pixelships.com

Arthur Kalliokoski
Second in Command
February 2005
avatar

Detecting how much memory is remaining is extremely difficult. Things such as format (32 bit rgba vs. 16 rgb etc.) and texture compression are part of the problem, also a particular texture may require more memory than you'd think, due to the card making scanlines longer than necessary for optimum access, things like that.

[EDIT]

I forgot about mipmapping taking up another 30% (?) memory.

They all watch too much MSNBC... they get ideas.

Go to: