Reputation: 1015
I have an application that issues about 100 drawcalls per frame, each with an individual VBO. The VBOs are uploaded via glBufferData
in a separate thread has has gl context resource sharing. The render thread tests buffer upload state via glClientWaitSync
.
Now my question:
According to the documentation glClientWaitSync
and GL_SYNC_FLUSH_COMMANDS_BIT
cause a flush at every call, right? This would mean that for every not yet finished glBufferData
in the upload thread I would have dozens of flushes in the render thread right? What impact on performance would it have if thus, in the worst case, I practically issue a flush before every drawcall?
Upvotes: 2
Views: 665
Reputation: 473447
The behavior of GL_SYNC_FLUSH_COMMANDS_BIT
has changed from its original specification.
In the original, the use of that bit was the equivalent of issuing a glFlush
before doing the wait.
However, GL 4.5 changed the wording. Now, it is the equivalent of having performed a flush immediately after you submitted that sync object. That is, instead of doing a flush relative to the current stream, it works as if you had flushed after submitting the sync. Thus, repeated use does not mean repeatedly flushing.
You can get the equivalent behavior of course by manually issuing a flush after you submit the sync object, then not using GL_SYNC_FLUSH_COMMANDS_BIT
when you wait for it.
Upvotes: 2