When I release the source PBO?

I use the PBO for asynchronous movement of data between the processor and my gpu.

In the transition from the GPU, I know I can delete the original texture after calling glMapBuffer to PBO.

However, what about the other way? When will I know that the transition from PBO to the texture (glTexSubImage2D (..., NULL)) is performed, and I can safely release or reuse the PBO? It is only as I tie texture or something else?

+4
source share
1 answer

I think that after the call glTexImage you can safely remove or reuse the buffer without error, because the driver handles everything for you, including deferred destruction (this is the advantage of buffer objects). But this means that calls glMapBuffer may be blocked until the completion of the previous copy glTexImage . If you want to reuse the buffer and just overwrite all its content, distribute it, usually by glBufferData before calling glMapBuffer . Thus, the driver knows that you do not care more about the previous content, and can set a new buffer that you can use immediately (memory containing the previous content, then released the driver when it is no longer used). Just keep in mind that your buffer object - it's just a memory descriptor that the driver can drive and copy on your own.

EDIT:. This means that otherwise (GPU-CPU), you can delete the original texture after returning glGetTexImage , as the driver controls everything behind the scenes. The decision to use buffer objects or not, should not have any effect on the order and the time when you call the function GL. Keep in mind that the call glDelete... does not immediately removes the object, it just puts the team in a stream GL commands and even up to the driver when he actually frees any memory.

+4
source

All Articles