21 #include "semaphore_manager.hpp" 32 for (
auto &semaphore : recycledSemaphores)
33 vkDestroySemaphore(device, semaphore,
nullptr);
38 recycledSemaphores.push_back(semaphore);
43 if (recycledSemaphores.empty())
45 VkSemaphoreCreateInfo info = { VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO };
46 VkSemaphore semaphore;
47 VK_CHECK(vkCreateSemaphore(device, &info,
nullptr, &semaphore));
52 auto semaphore = recycledSemaphores.back();
53 recycledSemaphores.pop_back();
SemaphoreManager(VkDevice device)
Constructor.
~SemaphoreManager()
Destructor.
void addClearedSemaphore(VkSemaphore semaphore)
Gives ownership of a cleared semaphore to the semaphore manager.
VkSemaphore getClearedSemaphore()
Takes ownership of a recycled semaphore or creates a new one.