MemAlloced()...what about video Memory?

BlitzMax Forums/BlitzMax Programming/MemAlloced()...what about video Memory?

Dubious Drewski(Posted 2005) [#1]
MemAlloced() tells you how much system memory is used,
but how do you know how much Video Memory is being
used? My unnamed Rpg at the moment uses quite a few
large textures (up to 512x512) and this sort of thing would
be useful to figure out videocard requirements.

Sure, I could use windows explorer and right-click on the Gfx\
folder, but that only works for certain circumstances, right?
Images are compressed by most videocards these days, and
there's no way for me to know by how much.


FlameDuck(Posted 2005) [#2]
Images are compressed by most videocards these days, and there's no way for me to know by how much.
Not unless you specificly ask them to, which unfortunately BlitzMAX doesn't.

So yeah. The combined size in pixels of all your images multiplied by 4 should give you a rough estimate on how much memory is being used on a 32-bit display.


xlsior(Posted 2005) [#3]
So yeah. The combined size in pixels of all your images multiplied by 4 should give you a rough estimate on how much memory is being used on a 32-bit display.


instead of taking the 'real' # of pixels, didn't you also have to round up to the nearest square power-of-2 size in OpenGL mode?

e.g. an 17x17 pixel image takes 32x32x4 bytes of video memory?


FlameDuck(Posted 2005) [#4]
e.g. an 17x17 pixel image takes 32x32x4 bytes of video memory?
I really can't comment on BlitzMAXs internal workings, as I haven't needed (or even wanted) to examine the source code in any greater detail.


Jay Kyburz(Posted 2005) [#5]
direct X would be the same


Dreamora(Posted 2005) [#6]
Yes you have to round it up to the next square power of 2 (OpenGL 1.2 forced not BM, just to mention).
This is why its normally more intelligent creating the image itself on the correct size instead of wasting VRAM with a black band which is used to fill up (not like B3D which resized the texture)


Dubious Drewski(Posted 2005) [#7]
So, I have some textures which are 256x128. Do you think
that I'm wasting half of my video memory on those? Is a
square image always better?


Gabriel(Posted 2005) [#8]
They're rounded to a power of 2, not a square power of 2. 256x128 will not need to be rounded at all, it's a perfect size.


FlameDuck(Posted 2005) [#9]
Is a square image always better?
Not always, no. Graphics cards that can only handle square textures are few, and far between, especially these days.