VRAM info?

BlitzMax Forums/OpenGL Module/VRAM info?

eindbaas(Posted 2007) [#1]
Is there a way to see how much of the memory on my videocard is already in use/free?


Dreamora(Posted 2007) [#2]
No, OpenGL has no texture management.
At best you could try to "guess" it but the results normally are highly unsatisfying.


eindbaas(Posted 2007) [#3]
So how far would i be off if i calculate the memsize of every texture i load? What else goes in there?


Dreamora(Posted 2007) [#4]
- Most important: Mipmaps will raise the size to 1.33 - 1.5 times the pure byte size of the texture (means height * width * bufferFormatSize)
- Render Surfaces which you will be using as you asked for GLSL integration
- Backbuffer Size * Number of Backbuffers


xlsior(Posted 2007) [#5]
- and round up to the next square power-of-two size for each texture (e.g. an 800x600 image takes up 1024x1024 pixels of space, with 4 bytes per pixel = 4,194,304 bytes.


xlsior(Posted 2007) [#6]
Also, here's some code that will return the total amount of RAM for ATI cards... If anyone knows how to obtain the same info for nvidia and others I'd appreciate it. :-?



Sample Output:


Number of CPUs/cores: 2
CPU Speed in MHz : 2400
CPU Name String : Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz
CPU Identifier : x86 Family 6 Model 15 Stepping 6
Vendor Identifier : GenuineIntel

ATI Video Adapter : Radeon X1650 Series (0x00000000)
Board Manufacturer : Hightech Information System Ltd. (0x000017af)
ATI Device ID : 7291 (0x00007291)
ATI BIOS Date : 01/01/07 (0x00010107)
ATI Chip ID : RV560 (0x00000171)
ATI 2D Driver : 6.14.10.6641 (0x00000000)
ATI D3D Driver : 6.14.10.440 (0x00000000)
ATI OGL Driver : 6.14.10.6120 (0x00000000)
ATI Bus Type : PCI Express x16 (0x00000010)
ATI Memory Size : 256 MB (0x00000200)
ATI Memory Type : DDR3 (0x00000000)
DirectX Version : 9.0c (0x09000000)





ImaginaryHuman(Posted 2007) [#7]
Cool, now make that cross-platform.


xlsior(Posted 2007) [#8]
Cool, now make that cross-platform.


I'm sure there are ways to get that kind of info on all platforms, but not by using this piece of code -- all it does is parse the windows registry for the correct info, so it's never going to be cross-platform...


MGE(Posted 2007) [#9]
The texture resources are halved when running in 16bit mode compared to 32bit mode right?


xlsior(Posted 2007) [#10]
Not sure, they might be stored in 32-bit mode internally anyway.


ImaginaryHuman(Posted 2007) [#11]
It's hard to tell what format the textures are stored in internally, regardless of what you requested. You also have to consider space needed for the depth buffer if you end up with one (regardless of whether you ask for one) - same goes for stencil/accum buffers. It is also possible that the GL system allocates more frames than just 2 for a double buffered system, it could be several backbuffers in a chain. Hard to tell.


Dreamora(Posted 2007) [#12]
Graphic Cards since Geforce 4 / 5 and up only operate in 32Bit mode for RGB textures and similar, no mather what depth you specify. They just "downgrade" the output again to it.


Tom(Posted 2007) [#13]
Vertex buffer objects are stored in local video memory too, don't forget them.


ImaginaryHuman(Posted 2007) [#14]
Also if you start getting into things like display lists they are stored in video ram.

What we really need as a part of BlitzMax by default is a simple SystemInfo command which returns some kind of easily parseable string (or series of different values returned each time you call it), which tells us enough about the hardware we're running on to be useful - e.g. the video ram size alone would be great.