I’ve added support of ARB_sync to my engine. Unfortunately it does not work as I expected. Function pair glFenceSync/glWaitSync works well, no complains. But functions glFenceSync/glGetSynciv does not.
I have two contexts that must be synchronized. First context prepares something for the second context. When the job has not finished yet, the second context does not complain, it will ask next time. This works well in theory, not in practice. I check the fence by calling glGetSynciv(sync, GL_SYNC_STATUS, …). Unfortunately there is some kind of stall in OpenGL drivers. The function does not return immediately. It depends on how much is in the pipeline. The function takes between 0.002ms up to 10ms! (CPU time). But if I call glGetSynciv in the same context I called glFenceSync, then the function returns immediately (0.002ms) even if pipeline is full.
I know almost all glGet* stall. But in my opinion this one should not stall. I really do not want to wait until it returns GL_SIGNALED. For waiting there are gl*WaitSync()
Is there any way to check fence status without stalling? Or is this a driver bug?
GTX260, Win7 x64, drv 197.45