video memory loss problem

Blitz3D Forums/Blitz3D Beginners Area/video memory loss problem

3DFish(Posted 2005) [#1]
Is there a way to recover video memory when hiding objects?

I have a 32MB Nvidia Riva graphics card.
After my game is loaded, I see that the available memory is 22MB.

When the player starts walking around in the game, the available memory drops down too 18MB as soon as the trees are drawn.

When the camera goes under water and starts drawing the fish, the available memory drops down to 16MB.

When I hide the all trees on the surface, the available memory stays at 16MB.

I've noticed that each time I show an object, the video memory gets lower and lower.
I assumed that the memory would get higher when I hide the objects. But it is not the case.

Anybody have any ideas?

Thanks
Conrad


DJWoodgate(Posted 2005) [#2]
I would assume that this is controlled automatically, so the oldest stuff that is not needed is deleted from the card to make room for new stuff. The more stuff that is left on the card the better because moving stuff to the card is slow. Also, just because something is hidden in one frame does not mean it might not be shown again in the very next frame, so this sort of first in first out approach should really pay dividends performance wise.


767pilot(Posted 2005) [#3]
or you could just buy a new 256mb video card :)


Mustang(Posted 2005) [#4]
AGP, Windows and Blitz3D manages your memory - don't worry. VRAM and AGP downloads and uploads textures and geometry all the time... but if you have some memory left there is no need to manage it. So basically if you don't use much big textures even 16meg will be okay. If you use constantly more VRAM than you have the AGP swapping will make things jerky and you need more of it to be able to play smoothly. Also note that higher screen resolutions will take bigger chunk of your VRAM permanently... I posted recently formulas how to calculate VRAM usage, it's here somewhere...


BlackD(Posted 2005) [#5]
yeah.. here: :)

http://www.blitzbasic.co.nz/Community/posts.php?topic=24157

The best explanation I've seen yet.. In all my calc's I forgot about MIPs altogether. Nice one Mustang.

+BlackD


3DFish(Posted 2005) [#6]
thanks for the useful info Mustang.

Looks like my game will not be playing on screen
cards with less than 32 MB.


HappyCat(Posted 2005) [#7]
What I'm seeing is with the code below, just intialising Graphics3D eats up 22Mb on my video card (it's a 128Mb). Is that normal? Seems a bit excessive - or is it just because the card has so much it takes a bigger chunk? I don't actually have any PCs with less than a 128 Mb graphics card to test it on.
Start = AvailVidMem()
Print "Free = " + Start + " = " + Start / 1024 / 1024 + "Mb(ish)"
WaitKey()

Graphics3D 800, 600, 32, 2

Free = AvailVidMem()
Used = Start - Free
Text 0, 0, "Free = " + Free + " = " + Free / 1024 / 1024 + "Mb(ish)"
Text 0, 20, "Used = " + Used + " = " + Used / 1024 / 1024 + "Mb(ish)"

Flip

WaitKey()
End
I understand that Blitz tries it's best to manage gfx card memory useage when you load and use textures, but 22Mb before I do anything seems a bit excessive.

Edit: By my calculations it should be using 5760000 bytes or about 5.5 Mb (or is my maths crap?)

Edit: Should have said that the figures I get are:
Free = 121901056 = 116Mb(ish)
Hit a key and ...
Free = 97882112 = 93Mb(ish)
Used = 24018944 = 22Mb(ish)


Floyd(Posted 2005) [#8]
My 64M graphics card shows about 4MB used, as expected.

Roughly: 600*800 = 'half a million'. Then 4 bytes per pixel and two buffers.

Why does yours show 22MB used? It's hard to say. I assume it's just the way the driver manages things. Maybe it allocates a block of memory to itself as a kind of graphics 'swap file'.


HappyCat(Posted 2005) [#9]
Yeah, just tried on my other PC (has a 128Mb GeForce 4) and it says ~4Mb used. The other PC (the one I use for most of my development and the one that reported 22Mb used) has a 128Mb Intel thingy - you're right, must be drivers and not Blitz. Guess I'll do memory useage monitoring on the PC with the GeForce then :-)


Strider Centaur(Posted 2005) [#10]
Happy Cat, maybe you have something else stored in VRAM from another application at the time, like virtual desktops, windows, etc, etc?


HappyCat(Posted 2005) [#11]
Looking at the vid card properties (which lists memory used), before I run the above proggie, there's 11Mb used (presumably by desktop etc.), after there's 34Mb used. So it is Blitz - but as I said, it looks like it's the Intel drivers so I'm not terribly worried anymore.