How mandatory is glFenceSync on PowerVR GPUs?


I have a scenario where I upload VBOs from a worker thread using glBufferData. After the glBufferData, I insert a glFenceSync. The VBOs are rendered in the render thread using glDrawArrays after waiting for the fence using glClientWaitSync. I disabled the glFenceSync once for a test and experienced no visual artifacts or otherwise odd behaviour.
My question is: Can this behaviour be expected under these circumstances? Or am I just lucky? Do PowerVR drivers take additional efforts to enforce synchronization on its buffers if a draw command is issued?



No, this behaviour cannot be expected at all, and, as you suspected, you are just being lucky.

However, you may not be that lucky: assuming your calls to glBufferData and glDrawArrays are happening more or less simultaneously, it is very probable that glBufferData is much faster and finishes much earlier than glDrawArrays. Try putting a small sleep (something like “std::this_thread::sleep_for(10ms)”) just before your glBufferData call (without synchronisation) and see if you can make artifacts appear that way.

Bear in mind that things in different unsynchronised threads happening “more of less simultaneously” is absolutely not reliable, no matter how hard you try. You need synchronisation at some point.

Even if the drivers were to somehow enforce synchronisation in this case, they might not in the future. It might even be unintended. In any case, you should not rely on it.

I hope that answers your questions.


© Imagination Technologies Limited. All rights reserved.
Privacy PolicyTerms & ConditionsTrademarksCookies