PDA

View Full Version : Max Number of Buffer Objects



WaltN2
11-17-2014, 10:44 AM
Is there a query that tells me the maximum number of buffer objects that I can have?

Or is the only limit the maximum positive number I can represent in the first argument of glGenBuffers, with something signaling me that the GPU has run out of memory eventually?

mhagain
11-17-2014, 11:42 AM
OpenGL as a general rule doesn't specify this kind of maximum for any type of object; you won't find such maximums for buffers, textures, programs, etc.

What that means is that it's going to be very much implementation-dependent. Some implementations will let you create buffers until you run out of GPU memory, some might have a maximum value on the buffer object names, some might start creating buffers in system memory (and may even page them out to disk if required), etc.

To be honest, if you're hoping to use such a hypothetical maximum to make decisions about creating resources in your program, you're doing it the wrong way around. Instead you should decide a minimum specification (1gb of GPU RAM is reasonable for low/mid-end in 2014) and size your working set (of buffers and other objects) to fit within that minimum, reducing polycounts and texture dimensions as appropriate until you fit.

carsten neumann
11-17-2014, 12:09 PM
For completeness/nitpicking (;)) sake: glGenBuffers does not create buffer objects, it only reserves names for them. The actual object (i.e. the thing where the implementation stores state) is created when such a name is bound for the first time - or when using the function glCreateBuffers introduced in 4.5/ARB_direct_state_access extension. That state is likely to always be in CPU memory (it's only manipulated by the CPU in response to API calls), while the actual buffer data store (allocated with glBufferData/glBufferStorage) may be in GPU memory if the implementation decides that is a good idea.

WaltN2
11-21-2014, 05:32 AM
Thanks for your perspectives.