PBO's & multithreading

Hi, just a quicky…

I have a dual window setup (multi-monitor) with each running in it’s own thread. I also have a hidden window (again in a seperate thread) used to share/upload textures using PBO’s. Actually the shared window is used to replace parts of existing textures.

My question, is what happens when the hidden window is altering texture contents, and one of the other threads tries rendering with it (before DMA is complete)? I ASSUME the rendering thread will be stalled until the update is complete - but as we all know assumptions can be dangerous things!

Many thanks,
Mark

From my knowledge, this is safe in CUDA programming where there is a concept of shared memory and this assumption is true.

It is undefined behavior. It depends on drivers and/or card model. From my experience the texture is sometimes seen by other threads as not updated. There is no synchronization mechanism among opengl context.

Use PBO and load textures in your main gl context.