Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: persistent buffer mapping - what kind of magic is this?

  1. #1
    Newbie Newbie
    Join Date
    Mar 2014
    Posts
    2

    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

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Dec 2007
    Location
    Hungary
    Posts
    985
    Quote Originally Posted by st4ck0v3rfl0w View Post
    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?
    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.

    Quote Originally Posted by st4ck0v3rfl0w View Post
    2. Is the transfer completely asynchronous and can the GPU work on different matter while data is transferred?
    Once again, there isn't always a need for data transfer (copy).

    Quote Originally Posted by st4ck0v3rfl0w View Post
    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?
    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.

    Quote Originally Posted by st4ck0v3rfl0w View Post
    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.
    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.
    Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
    Technical Blog: http://www.rastergrid.com/blog/

  3. #3
    Newbie Newbie
    Join Date
    Mar 2014
    Posts
    2
    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?

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Dec 2007
    Location
    Hungary
    Posts
    985
    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.
    Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
    Technical Blog: http://www.rastergrid.com/blog/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •