MCPcopy Create free account
hub / github.com/Overv/VulkanTutorial / cleanup

Method cleanup

code/15_hello_triangle.cpp:140–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138 }
139
140 void cleanup() {
141 vkDestroySemaphore(device, renderFinishedSemaphore, nullptr);
142 vkDestroySemaphore(device, imageAvailableSemaphore, nullptr);
143 vkDestroyFence(device, inFlightFence, nullptr);
144
145 vkDestroyCommandPool(device, commandPool, nullptr);
146
147 for (auto framebuffer : swapChainFramebuffers) {
148 vkDestroyFramebuffer(device, framebuffer, nullptr);
149 }
150
151 vkDestroyPipeline(device, graphicsPipeline, nullptr);
152 vkDestroyPipelineLayout(device, pipelineLayout, nullptr);
153 vkDestroyRenderPass(device, renderPass, nullptr);
154
155 for (auto imageView : swapChainImageViews) {
156 vkDestroyImageView(device, imageView, nullptr);
157 }
158
159 vkDestroySwapchainKHR(device, swapChain, nullptr);
160 vkDestroyDevice(device, nullptr);
161
162 if (enableValidationLayers) {
163 DestroyDebugUtilsMessengerEXT(instance, debugMessenger, nullptr);
164 }
165
166 vkDestroySurfaceKHR(instance, surface, nullptr);
167 vkDestroyInstance(instance, nullptr);
168
169 glfwDestroyWindow(window);
170
171 glfwTerminate();
172 }
173
174 void createInstance() {
175 if (enableValidationLayers && !checkValidationLayerSupport()) {

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected