glClientWaitSync with GL_SYNC_FLUSH_COMMANDS_BIT doesn’t seem to flush

Greetings,

I have a GLES 3.2 program where a background thread uploads VBOs to a background gl context which are then provided to the render thread via context resource sharing. The command order in the upload thread is basically like this:

glGenBuffers
glBindBuffer
glBufferData
glDeleteSync ( if the fence variable is recycled )
glFenceSync ( for the new fence variable )
glClientWaitSync( fence, GL_SYNC_FLUSH_COMMANDS_BIT, 0 );
glBindBuffer (…, 0 )

Then the buffer and fence are passed to the main render thread which waits on fence via glWaitSync. However, after some runtime the render thread gets stuck in glWaitSync. Deep down in the driver it seems to stand in a sched_yield system call.

If I replace glClientWaitSync with regular glFlush it won’t get stuck.

Does anyone know this problem?

Ubuntu 18.04.5 LTS x64
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GT 1030/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 455.23.04

Regards.

So are you using OpenGL ES 3.2, or desktop GL 4.6 the way your version string says?

The GLES portion of glxinfo:

OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 455.23.04
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

The created context is apparently 3.1, egl is 1.5.