persistent buffer mapping - what kind of magic is this?

Hi,

I am very new to OpenGL and can not quite wrap my mind around the concept of persistently mapped buffers.

  1. The Memory resides on the GPU right? The pointer I get is to some sort of special memory, that gets transferred over the bus without touching client side memory? How is this technique called?

  2. Is the transfer completely asynchronous and can the GPU work on different matter while data is transferred?

  3. If I use the COHERENT flag will it sync for most gl calls and buffer reads? Is it just for the lazy programmer or is there a benefit to it I can not achieve by syncing manually?

  4. Is this only possible on newer Hardware? I have looked for a database that shows which extensions are supported by which hardware. buffer_storage only showed some of the newer gpus.

thanks,
st4ck0v3rfl0w

The memory doesn’t always reside on the GPU, sometimes it’s a special system memory pool that is accessible to the GPU.
The pointer you get is not always some temporary special memory that gets transferred, many cases the pointer you get is a direct pointer to either GPU memory, or special system memory accessible by the GPU. A copy in most cases is not necessary. Actually that’s what persistent mapped buffers allow, copy-less mapping. The memory you see with persistent mapping is the same what the GPU sees.

Once again, there isn’t always a need for data transfer (copy).

It won’t sync. COHERENT means that the type of memory you get is coherent between the CPU and the GPU, thus modifications are “immediately” seen. With non-coherent memory it isn’t guaranteed.

It is possible on pretty much any GPU on the market. The reason why very old GPUs don’t have the feature is because the drivers for those are no longer maintained. Not to mention that not every GPU vendor has released the feature quite yet, considering it is a fairly new feature.

Thanks that helped me a lot!

Dependent on the hardware configuration: could it be better in some cases performance-wise to use coherent memory because it does not need an call into the GL machine to ensure the data is visible?

That’s difficult to answer.
FlushMappedBufferRange on a non-coherent persistent mapped buffer is unlikely to be an expensive call, but it depends on the granularity you flush on.

It’s better to test it and measure it.