![]() |
Vireo
0.0
Vireo 3D Rendering Hardware Interface
|
A semaphore is a GPU/GPU synchronization primitive. They are use between render passes : it ensures ordering between queue submissions (e.g. “don’t start color pass until depth pre pass finishes”).
There is two types of semaphores :
Create the semaphore with vireo::Vireo::createSemaphore with the vireo::SemaphoreType::BINARY parameter :
Then use it with vireo::SubmitQueue::submit. In the following example both submissions will be started in parallel, the input assembly and vertex shaders will be executed in parallel, then the second submission will wait for the first vertex shader to end before starting the fragment shader :
Create the semaphore with vireo::Vireo::createSemaphore with the vireo::SemaphoreType::TIMELINE parameter :
The reference value of the semaphore counter starts at zero at will be incremented each time it will be signaled.
You can use vireo::Semaphore::incrementValue, vireo::Semaphore::decrementValue or vireo::Semaphore::setValue to specify the reference value before waiting but be careful to set the correct value back before signaling.
Example of a submission waiting for two other render passes to signal the semaphore :
Check the "Deferred" example in the Samples repository for a complete example of a timeline semaphore use.