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

Method cleanup

code/16_frames_in_flight.cpp:141–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected