| 1328 | } |
| 1329 | |
| 1330 | void VulkanBaseApp::createSyncObjects() |
| 1331 | { |
| 1332 | VkSemaphoreCreateInfo semaphoreInfo = {}; |
| 1333 | semaphoreInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO; |
| 1334 | VkFenceCreateInfo fenceInfo = {}; |
| 1335 | fenceInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO; |
| 1336 | fenceInfo.flags = VK_FENCE_CREATE_SIGNALED_BIT; |
| 1337 | |
| 1338 | m_inFlightFences.resize(MAX_FRAMES_IN_FLIGHT); |
| 1339 | m_imageAvailableSemaphores.resize(MAX_FRAMES_IN_FLIGHT); |
| 1340 | m_renderFinishedSemaphores.resize(MAX_FRAMES_IN_FLIGHT); |
| 1341 | |
| 1342 | for (size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++) { |
| 1343 | if (vkCreateSemaphore(m_device, &semaphoreInfo, nullptr, &m_imageAvailableSemaphores[i]) != VK_SUCCESS) { |
| 1344 | throw std::runtime_error("Failed to create image available semaphore!"); |
| 1345 | } |
| 1346 | if (vkCreateSemaphore(m_device, &semaphoreInfo, nullptr, &m_renderFinishedSemaphores[i]) != VK_SUCCESS) { |
| 1347 | throw std::runtime_error("Failed to create image available semaphore!"); |
| 1348 | } |
| 1349 | if (vkCreateFence(m_device, &fenceInfo, nullptr, &m_inFlightFences[i]) != VK_SUCCESS) { |
| 1350 | throw std::runtime_error("Failed to create image available semaphore!"); |
| 1351 | } |
| 1352 | } |
| 1353 | |
| 1354 | #ifdef _VK_TIMELINE_SEMAPHORE |
| 1355 | m_vkImageAcquiredSemaphores.resize(MAX_FRAMES_IN_FLIGHT); |
| 1356 | m_vkRenderCompleteSemaphores.resize(MAX_FRAMES_IN_FLIGHT); |
| 1357 | for (size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++) { |
| 1358 | if (vkCreateSemaphore(m_device, &semaphoreInfo, nullptr, &m_vkImageAcquiredSemaphores[i]) != VK_SUCCESS) { |
| 1359 | throw std::runtime_error("Failed to create image acquired semaphore!"); |
| 1360 | } |
| 1361 | if (vkCreateSemaphore(m_device, &semaphoreInfo, nullptr, &m_vkRenderCompleteSemaphores[i]) != VK_SUCCESS) { |
| 1362 | throw std::runtime_error("Failed to create render complete semaphore!"); |
| 1363 | } |
| 1364 | } |
| 1365 | #endif /* _VK_TIMELINE_SEMAPHORE */ |
| 1366 | } |
| 1367 | |
| 1368 | void VulkanBaseApp::getWaitFrameSemaphores(std::vector<VkSemaphore> &wait, |
| 1369 | std::vector<VkPipelineStageFlags> &waitStages) const |
nothing calls this directly
no outgoing calls
no test coverage detected