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

Method ~ApiVulkanSample

framework/api_vulkan_sample.cpp:598–643  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

596}
597
598ApiVulkanSample::~ApiVulkanSample()
599{
600 if (has_device())
601 {
602 get_device().wait_idle();
603
604 // Clean up Vulkan resources
605 if (descriptor_pool != VK_NULL_HANDLE)
606 {
607 vkDestroyDescriptorPool(get_device().get_handle(), descriptor_pool, nullptr);
608 }
609 destroy_command_buffers();
610 if (!uses_dynamic_rendering())
611 {
612 vkDestroyRenderPass(get_device().get_handle(), render_pass, nullptr);
613 }
614 for (uint32_t i = 0; i < framebuffers.size(); i++)
615 {
616 vkDestroyFramebuffer(get_device().get_handle(), framebuffers[i], nullptr);
617 }
618
619 for (auto &swapchain_buffer : swapchain_buffers)
620 {
621 vkDestroyImageView(get_device().get_handle(), swapchain_buffer.view, nullptr);
622 }
623
624 for (auto &shader_module : shader_modules)
625 {
626 vkDestroyShaderModule(get_device().get_handle(), shader_module, nullptr);
627 }
628 vkDestroyImageView(get_device().get_handle(), depth_stencil.view, nullptr);
629 vkDestroyImage(get_device().get_handle(), depth_stencil.image, nullptr);
630 vkFreeMemory(get_device().get_handle(), depth_stencil.mem, nullptr);
631
632 vkDestroyPipelineCache(get_device().get_handle(), pipeline_cache, nullptr);
633
634 vkDestroyCommandPool(get_device().get_handle(), cmd_pool, nullptr);
635
636 vkDestroySemaphore(get_device().get_handle(), semaphores.acquired_image_ready, nullptr);
637 vkDestroySemaphore(get_device().get_handle(), semaphores.render_complete, nullptr);
638 for (auto &fence : wait_fences)
639 {
640 vkDestroyFence(get_device().get_handle(), fence, nullptr);
641 }
642 }
643}
644
645void ApiVulkanSample::view_changed()
646{}

Callers

nothing calls this directly

Calls 3

sizeMethod · 0.80
wait_idleMethod · 0.45
get_handleMethod · 0.45

Tested by

no test coverage detected