Graphics memory used?

BlitzMax Forums/BlitzMax Programming/Graphics memory used?

Grey Alien(Posted 2006) [#1]
Hi, Can I found out how much graphics memory is used easily? If the graphics memory used goes over the card's capacity will it get stored in RAM and shunted back and forth resulting in hideous slowdowns?

thanks.


Grisu(Posted 2006) [#2]
Think so.

We need a vidmemavail() command. +1


Dreamora(Posted 2006) [#3]
With DX you could use a DX call
OpenGL sadly has nothing like that so the only way would be a manual messuring method as all textures are bound when loaded. (OpenGL has no memory management like DX so stuff is either in VRAM or a pixmap)

But with 2D I somehow don't believe that it is possible to flood the VRAM.
Because cards that work with BM on usefull level have 32MB and thats already quite a lot for 2D after all.

Chance that fillrate and bandwidth will cause serious performance problems are likely larger ... especially if you have "special effects" (particles and the like)


Grey Alien(Posted 2006) [#4]
so there is no command in BMax, just a DX one. Well luckily I'm using DX then. Anyone know the command? thanks.

hmm, yeah I'm loading in a lot of 2D graphics, and when they are expanded out to powers of 2 (does this happen with each frame in an anim strip?), I guess it could comsume quite a lot actually, as it is a pro game with lots of pre-rendered anims. I do also have quite a few particles, but as the particle image is already on the card it should be OK right?


ozak(Posted 2006) [#5]
You can't tell how much video memory is used. Especially not when we're 3D accelerated like in BMax. I don't think never versions of DX have this command. Textures might get converted, swizzled, bank aligned and more by the driver/hardware so it's really impossible to tell. You could try to create a bunch of proxy textures using the corrosponing GL command to get a rough estimate. But those days are over, where you could get the amount of free video memory :)


Grey Alien(Posted 2006) [#6]
oh, bummer just wondered how my game fared that's all. Surely pro game studios must have *some* way of measuring it...


ozak(Posted 2006) [#7]
Yup. There's special NVidia diagnostics drivers which will tell you the info you need during development :)
And GLs proxy texture function can help determine it too.


Dreamora(Posted 2006) [#8]
Or as "easy way"
sum up the size of all textures you draw in the mainloop. Width * height * bitdepth of it.

As that stuff must be in VRAM, thats at least the "lowest req"


H&K(Posted 2006) [#9]
Just keep makeing images until ordanary ram starts to decrease, then you know how many images were needed to fill the video ram that you had left and you know how big your images were. Then NULL the images.


Grey Alien(Posted 2006) [#10]
hmm OK. So does anyone have an answer to if AnimImages scale up to power of 2 for each image in the strip or does the strip just get scaled up?


Dreamora(Posted 2006) [#11]
Each Image in an anim image is an own image. So every one is part of an own square power of 2. BUT it is not scaled up as in old blitz. BM just creates a larger textures and modifies the UV to only show the really textured part in its original size.
There are 2 internal fields you can use to get the real size of the texture (imagewidth won't do it when I remember correctly). Alternatively you need to call a nextPow2 function as BM does when creating the texture buffers.


tonyg(Posted 2006) [#12]
Someone, somewhere (I' sure it was these forums but can't find it) suggested VidMemWatch which seems quite handy.


WendellM(Posted 2006) [#13]
VidMemWatch which seems quite handy.

I just tried it and yes, it seems handy indeed. Thanks for the pointer.


Grey Alien(Posted 2006) [#14]
hmm interesting thanks.

Dreamora: I'm confused, each one (in anim strip) is power of 2 but not scaled up? Surely those contradict each other (but of course I'm being dumb, please explain....) + which old Blitz? BPlus or 3D?


Yan(Posted 2006) [#15]
He means the pixmap isn't scaled up to fit the texture, the texture is created at the nearest pow2 size and the pixmap is slapped into the top left corner of the texture.


Grey Alien(Posted 2006) [#16]
ah i see, thanks.