Reputation: 2367
May I create a glFenceSync in one thread, and wait for it in another thread?
or
May I create a glFenceSync in one context and wait for it in another context?
Upvotes: 4
Views: 1233
Reputation: 45362
May I create a
glFenceSync
in one thread, and wait for it in another thread?
Every GL function you can call requires you to have made current a GL context for the thread you are calling this, and a GL context can be current to at most one threadt at any point in time.
Technically, the answer to your question is still "yes", since you can issue a glFenceSync
on one thread, move the context over to another thread and call gl[Client]WaitSync
there - but that is probably not what you had in mind, and I also don't see an obvious use case for such a pattern.
May I create a
glFenceSync
in one context and wait for it in another context?
Sync objects are share-able in the GL, so if you create contexts which share objects, they will also share sync objects, and the spec explicitly allows waiting on sync objects of another context. Actually, it is even specified that there can be multiple simultaneous waits on a single sync object, and all of them will be unblocked when the sync object gets signaled (but in an implementation-dependent order).
Upvotes: 3