MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Samples / request_semaphore

Method request_semaphore

framework/semaphore_pool.cpp:73–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73VkSemaphore SemaphorePool::request_semaphore()
74{
75 // Check if there is an available semaphore
76 if (active_semaphore_count < semaphores.size())
77 {
78 return semaphores[active_semaphore_count++];
79 }
80
81 VkSemaphore semaphore{VK_NULL_HANDLE};
82
83 VkSemaphoreCreateInfo create_info{VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO};
84
85 VkResult result = vkCreateSemaphore(device.get_handle(), &create_info, nullptr, &semaphore);
86
87 if (result != VK_SUCCESS)
88 {
89 throw std::runtime_error("Failed to create semaphore.");
90 }
91
92 semaphores.push_back(semaphore);
93
94 active_semaphore_count++;
95
96 return semaphore;
97}
98
99void SemaphorePool::reset()
100{

Callers 2

render_swapchainMethod · 0.45
render_compute_postMethod · 0.45

Calls 2

sizeMethod · 0.80
get_handleMethod · 0.45

Tested by

no test coverage detected