PBOs and multithreading

I have an application where i have multiple software renderers.

I’m using OpengGL to perform processing on these images.

In my current solution the software renderer’s render to system memory and then I copy to this into a pbo on the OpenGL context thread.

However it would be more efficient if I could directly render into a pbo (which is essentially a page-locked system memory anyways), and then initiate an async dma transfer to gpu, thus remove the copying cpu overhead.

The problem with this is that the renderers are running on their own threads and not in the ogl context thread.

Soo my question is: What is the behavior of PBOs in a multithreaded enviroment? creation, mapping, unmapping etc…

You can create PBOs and map them in your GL thread, then pass the addresses to the worker threads. Once they have signaled your GL thread that they are done, the GL thread can unmap the PBOs and start rendering.

Good idea. I’ve tried it and it seems to work. Although I’m getting some random crashes with glMap… will do some more debugging… probably something I’m doing wrong.

EDIT: Got it working perfectly. Kudos.