Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where and what is "OpenGL memory" used by VBOs, etc

I am learning how to use VBOs and, as the book says,

"...you can free up CPU memory by moving vertex data to the OpenGL memory on the GPU."

Well, just exactly what can a GPU handle in this regard? Is it acceptable to assume that the "OpenGL memory" can store the vertex data for millions of polygons? What about the GPU in a mobile device?

While developers are used to having a frame of reference for memory restrictions on a CPU, learning OpenGL is partly challenging because I don't know much about GPUs and what to expect from their hardware. So when I read a vague statement like the above, it makes me nervous.

like image 467
johnbakers Avatar asked Feb 28 '13 14:02

johnbakers


People also ask

How do OpenGL buffers work?

Buffer Objects are OpenGL Objects that store an array of unformatted memory allocated by the OpenGL context (AKA the GPU). These can be used to store vertex data, pixel data retrieved from images or the framebuffer, and a variety of other things.

What is a GPU buffer?

The GPU Command Buffer system is the way in which Chrome talks to the GPU either OpenGL or OpenGL ES (or OpenGL ES emulated through ANGLE). It is designed to have an API that emulates the OpenGL ES 2.0 API enforcing the restrictions of that API and working around incompatibilities in drivers and platforms.


2 Answers

OpenGL has an abstract device and memory model. And technically in the world of OpenGL there is not CPU and GPU memory, but client and server memory. OpenGL buffer objects live on the server side. Server, that simply means everything the OpenGL driver abstracts away. And the OpenGL driver is perfectly allowed to swap out data from the GPU to the CPU if the GPU memory, which acts like a cache, is not sufficient. Hence what your book states:

"...you can free up CPU memory by moving vertex data to the OpenGL memory on the GPU."

Is not entirely correct, as the data in a OpenGL buffer object may very well reside in CPU memory.

like image 178
datenwolf Avatar answered Sep 25 '22 23:09

datenwolf


There are minimal requirements in spec, but in general, the amount of GPU memory is quite broadly available information which you certainly noticed when buying your PC (overhyped by sellers). However, as @datenwolf said, you can't really know where the data actually is; all that matters is that you can destroy your temporary buffers.

You should take capabilities of the targetted hardware into account regardless of the technology used.

like image 34
Bartek Banachewicz Avatar answered Sep 23 '22 23:09

Bartek Banachewicz