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

As I understand the issue: NVidia driver renders same queue on all GPUs. When I use glFenceSync the driver takes the signal from first GPU and unlocks wait on all GPUs. It should wait for a signal from each GPU’s queue and unlock respective glWaitSync. Or it can wait for glFenceSync signal from all GPUs and only then unlock all glWaitSyncs.