MCPcopy Create free account
hub / github.com/SFML/SFML / cleanupSwapchain

Method cleanupSwapchain

examples/vulkan/Vulkan.cpp:329–370  ·  view source on GitHub ↗

Cleanup swapchain

Source from the content-addressed store, hash-verified

327
328 // Cleanup swapchain
329 void cleanupSwapchain()
330 {
331 // Swapchain teardown procedure
332 for (VkFence fence : fences)
333 vkWaitForFences(device, 1, &fence, VK_TRUE, std::numeric_limits<std::uint64_t>::max());
334
335 if (!commandBuffers.empty())
336 vkFreeCommandBuffers(device, commandPool, static_cast<std::uint32_t>(commandBuffers.size()), commandBuffers.data());
337
338 commandBuffers.clear();
339
340 for (VkFramebuffer swapchainFramebuffer : swapchainFramebuffers)
341 vkDestroyFramebuffer(device, swapchainFramebuffer, nullptr);
342
343 swapchainFramebuffers.clear();
344
345 if (graphicsPipeline)
346 vkDestroyPipeline(device, graphicsPipeline, nullptr);
347
348 if (renderPass)
349 vkDestroyRenderPass(device, renderPass, nullptr);
350
351 if (pipelineLayout)
352 vkDestroyPipelineLayout(device, pipelineLayout, nullptr);
353
354 if (depthImageView)
355 vkDestroyImageView(device, depthImageView, nullptr);
356
357 if (depthImageMemory)
358 vkFreeMemory(device, depthImageMemory, nullptr);
359
360 if (depthImage)
361 vkDestroyImage(device, depthImage, nullptr);
362
363 for (VkImageView swapchainImageView : swapchainImageViews)
364 vkDestroyImageView(device, swapchainImageView, nullptr);
365
366 swapchainImageViews.clear();
367
368 if (swapchain)
369 vkDestroySwapchainKHR(device, swapchain, nullptr);
370 }
371
372 // Cleanup and recreate swapchain
373 void recreateSwapchain()

Callers

nothing calls this directly

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected