Determine free video RAM?

I have searched a lot for this but I cannot find anything on how to do something so apparently trivial:

How can I determine the total amount of video RAM and more importantly how much video RAM is actually free?

By video RAM I mean the physical memory that is on the graphics card – i.e. the memory that I will allocate when I use VBOs and do glBufferData() which allocates VRAM.

Why do I want to know this? Because I have 1.4 GiB of data that I want to copy, but my graphics card cannot contain it all simultaneously; as such, I want to know how much is free and copy as much as I can at a time.

Depends on the graphics card (i.e. driver)

(But be aware that this extension is both new and experimental. Exists since 196.21 drivers)

For ATI:

Thanks a lot, after installing the latest drivers it appears to work and give me the data.

However, I’m beginning to think that I’m doing this in the completely wrong manner;

OpenGL implementations are expected to manage the residence of
objects (that is, the memory pools in which objects are placed)
automatically.  This is simple for applications to use

Since OpenGL is supposed to handle this automatically, then I must be doing something wrong since I just get an error and run out of memory?

What I’m doing is basically that I generate a lot of geometry, I allocate a VBO for this which is the size of that geometry and I try to copy from RAM to VRAM into this memory. This works fine when the data I want to copy is a couple hundred megabytes, but for a lot more I simply get the “Out of memory” error.

I realize obviously that the VRAM is not infinite and I would be fine with OpenGL shuffling around the data automatically between RAM and VRAM as needed – however, how do I do that?

You should split your large VBO in several smaller ones.
That way the driver will be able to juggle with the RAM<->VRAM swaps needed as I guess the whole data can not fit on the card at the same time.

Ah, I see; thanks, I’ll try that. :slight_smile:

Personally, I’ve found that on OpenGL 3 and above, if you exceed memory limits, you will either incur an exception, or return a blank screen.

This could very well be just my setup though (3 GTX 8800’s in SLI configuration), since SLI is far from perfect.