Set up the semaphores we use to synchronize frames among each other
| 2328 | |
| 2329 | // Set up the semaphores we use to synchronize frames among each other |
| 2330 | void setupSemaphores() |
| 2331 | { |
| 2332 | VkSemaphoreCreateInfo semaphoreCreateInfo = VkSemaphoreCreateInfo(); |
| 2333 | semaphoreCreateInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO; |
| 2334 | |
| 2335 | // Create a semaphore to track when an swapchain image is available for each frame in flight |
| 2336 | for (std::size_t i = 0; i < maxFramesInFlight; ++i) |
| 2337 | { |
| 2338 | imageAvailableSemaphores.push_back({}); |
| 2339 | |
| 2340 | if (vkCreateSemaphore(device, &semaphoreCreateInfo, nullptr, &imageAvailableSemaphores[i]) != VK_SUCCESS) |
| 2341 | { |
| 2342 | imageAvailableSemaphores.pop_back(); |
| 2343 | vulkanAvailable = false; |
| 2344 | return; |
| 2345 | } |
| 2346 | } |
| 2347 | |
| 2348 | // Create a semaphore to track when rendering is complete for each frame in flight |
| 2349 | for (std::size_t i = 0; i < maxFramesInFlight; ++i) |
| 2350 | { |
| 2351 | renderFinishedSemaphores.push_back({}); |
| 2352 | |
| 2353 | if (vkCreateSemaphore(device, &semaphoreCreateInfo, nullptr, &renderFinishedSemaphores[i]) != VK_SUCCESS) |
| 2354 | { |
| 2355 | renderFinishedSemaphores.pop_back(); |
| 2356 | vulkanAvailable = false; |
| 2357 | return; |
| 2358 | } |
| 2359 | } |
| 2360 | } |
| 2361 | |
| 2362 | // Set up the fences we use to synchronize frames among each other |
| 2363 | void setupFences() |
nothing calls this directly
no test coverage detected