glFinish in shared context environment


I plan to split my program into a render thread and a buffer upload thread using OpenGL context sharing. I need to support an OpenGL ES 2 environment, so I cannot use glFence functions for synchronization. That means, I will have to use glFinish on the buffer upload thread to make sure the buffer is uploaded once it leaves the influence of the upload thread.

My question is now whether calling glFinish on the upload thread will stall the render thread in some way (or cause it to process stuff immediately that would otherwise be advantageously delayed) or if it will just wait patiently until the other threads have processed the commands before its own?


The behaviour of glFinish will depend on the platform and the drivers you have. Our architecture is TBDR and on old platforms like SGX, glFinish or glFlush were not functional to avoid the performance impact. When functional, glFinish flushes (kicks) all outstanding 3D renders in a context although it will not block the thread. I will recommend to experiment a bit with it and to use PVRTune to see what is going on on your platform.