glWaitSync() does not wait when rendering on two GPUs

I have an issue while trying to implement asynchronous texture upload using parallel OpenGL contexts on a two GPU setup with mosaic configured. I am uploading texture using PBO, then I create sync with glFenceSync(), signalling to main thread that it can now call glWaitSync() to add waitSync in OpenGL commands queue.
The problem is that on secondary GPU it does not wait for a sync, but renders old data from texture instead.

The minimal reproducible project for it is on github (MSVC 64 bit, uses SDL2 (included)):

The video of a problem: glWaitSync bug when rendering on two GPUs - YouTube

3 Likes

Adding glFinish() before swapBuffers() fixes the issue, but it would reduce overall performance