| 1404 | } |
| 1405 | |
| 1406 | static void DestroySwapchain(bool destroyActualSwapchain) |
| 1407 | { |
| 1408 | for (std::size_t i = 0; i < COMMAND_BUFFER_COUNT; i++) |
| 1409 | { |
| 1410 | if (g_hImageAvailableSemaphores[i] != VK_NULL_HANDLE) |
| 1411 | { |
| 1412 | vkDestroySemaphore(g_hDevice, g_hImageAvailableSemaphores[i], g_Allocs); |
| 1413 | g_hImageAvailableSemaphores[i] = VK_NULL_HANDLE; |
| 1414 | } |
| 1415 | } |
| 1416 | for (std::size_t swapchain_img_index = 0; swapchain_img_index < g_SwapchainImageCount; swapchain_img_index++) |
| 1417 | { |
| 1418 | if (g_hRenderFinishedSemaphores.at(swapchain_img_index) != VK_NULL_HANDLE) |
| 1419 | { |
| 1420 | vkDestroySemaphore(g_hDevice, g_hRenderFinishedSemaphores[swapchain_img_index], g_Allocs); |
| 1421 | g_hRenderFinishedSemaphores[swapchain_img_index] = VK_NULL_HANDLE; |
| 1422 | } |
| 1423 | } |
| 1424 | |
| 1425 | for(size_t i = g_Framebuffers.size(); i--; ) |
| 1426 | vkDestroyFramebuffer(g_hDevice, g_Framebuffers[i], g_Allocs); |
| 1427 | g_Framebuffers.clear(); |
| 1428 | |
| 1429 | if(g_hDepthImageView != VK_NULL_HANDLE) |
| 1430 | { |
| 1431 | vkDestroyImageView(g_hDevice, g_hDepthImageView, g_Allocs); |
| 1432 | g_hDepthImageView = VK_NULL_HANDLE; |
| 1433 | } |
| 1434 | if(g_hDepthImage != VK_NULL_HANDLE) |
| 1435 | { |
| 1436 | vmaDestroyImage(g_hAllocator, g_hDepthImage, g_hDepthImageAlloc); |
| 1437 | g_hDepthImage = VK_NULL_HANDLE; |
| 1438 | } |
| 1439 | |
| 1440 | if(g_hPipeline != VK_NULL_HANDLE) |
| 1441 | { |
| 1442 | vkDestroyPipeline(g_hDevice, g_hPipeline, g_Allocs); |
| 1443 | g_hPipeline = VK_NULL_HANDLE; |
| 1444 | } |
| 1445 | |
| 1446 | if(g_hRenderPass != VK_NULL_HANDLE) |
| 1447 | { |
| 1448 | vkDestroyRenderPass(g_hDevice, g_hRenderPass, g_Allocs); |
| 1449 | g_hRenderPass = VK_NULL_HANDLE; |
| 1450 | } |
| 1451 | |
| 1452 | if(g_hPipelineLayout != VK_NULL_HANDLE) |
| 1453 | { |
| 1454 | vkDestroyPipelineLayout(g_hDevice, g_hPipelineLayout, g_Allocs); |
| 1455 | g_hPipelineLayout = VK_NULL_HANDLE; |
| 1456 | } |
| 1457 | |
| 1458 | for(size_t i = g_SwapchainImageViews.size(); i--; ) |
| 1459 | vkDestroyImageView(g_hDevice, g_SwapchainImageViews[i], g_Allocs); |
| 1460 | g_SwapchainImageViews.clear(); |
| 1461 | |
| 1462 | if(destroyActualSwapchain && (g_hSwapchain != VK_NULL_HANDLE)) |
| 1463 | { |
no test coverage detected