Calculating exact VRAM size of image...

Blitz3D Forums/Blitz3D Programming/Calculating exact VRAM size of image...

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

width*height*4 regardless of what bit depth screen res you are using, because Blitz works on 32bit images internally.

The power of 2 rounding can't really be calculated; it happens at a sort of gfx card/drivers/directx/blitz/phase of the moon-based type of occurance. Your image -may- be rounded up to the next power of 2 on width and/or height. It depends.

But, basically, if you can't fit the image in your entire vidmem (not just what's currently available, as what's in use can be paged out - and remember that the screen itself takes up a total size of screenwidth*screenheight*4*2 (for double buffers) - that automatically chews up your vidmem the second you make a call to Graphics()), you're screwed. I'm of the impression that vidmem cannot store 'part' of an image. However if the image does fit into total vidmem, but not into available vidmem, an older pic will get paged out and the new one loaded in, which 1) causes severe slowdown due to the AGP bus and 2) doesn't really affect the availvidmem command much, as it's mostly the same as before... obviously, it's not going to return a negative value...

For compatibility reasons, your image should not be larger than the dimensions of your screen anyway (another directx/gfx card/drivers/number of flies from 1000 camels-related issue), although Blitz is -supposed- to handle it intelligently behind the scenes. It probably does, but... you know... sometimes something happens that makes you feel unsure...