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

Method cleanup

code/29_mipmapping.cpp:275–323  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273 }
274
275 void cleanup() {
276 cleanupSwapChain();
277
278 vkDestroyPipeline(device, graphicsPipeline, nullptr);
279 vkDestroyPipelineLayout(device, pipelineLayout, nullptr);
280 vkDestroyRenderPass(device, renderPass, nullptr);
281
282 for (size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++) {
283 vkDestroyBuffer(device, uniformBuffers[i], nullptr);
284 vkFreeMemory(device, uniformBuffersMemory[i], nullptr);
285 }
286
287 vkDestroyDescriptorPool(device, descriptorPool, nullptr);
288
289 vkDestroySampler(device, textureSampler, nullptr);
290 vkDestroyImageView(device, textureImageView, nullptr);
291
292 vkDestroyImage(device, textureImage, nullptr);
293 vkFreeMemory(device, textureImageMemory, nullptr);
294
295 vkDestroyDescriptorSetLayout(device, descriptorSetLayout, nullptr);
296
297 vkDestroyBuffer(device, indexBuffer, nullptr);
298 vkFreeMemory(device, indexBufferMemory, nullptr);
299
300 vkDestroyBuffer(device, vertexBuffer, nullptr);
301 vkFreeMemory(device, vertexBufferMemory, nullptr);
302
303 for (size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++) {
304 vkDestroySemaphore(device, renderFinishedSemaphores[i], nullptr);
305 vkDestroySemaphore(device, imageAvailableSemaphores[i], nullptr);
306 vkDestroyFence(device, inFlightFences[i], nullptr);
307 }
308
309 vkDestroyCommandPool(device, commandPool, nullptr);
310
311 vkDestroyDevice(device, nullptr);
312
313 if (enableValidationLayers) {
314 DestroyDebugUtilsMessengerEXT(instance, debugMessenger, nullptr);
315 }
316
317 vkDestroySurfaceKHR(instance, surface, nullptr);
318 vkDestroyInstance(instance, nullptr);
319
320 glfwDestroyWindow(window);
321
322 glfwTerminate();
323 }
324
325 void recreateSwapChain() {
326 int width = 0, height = 0;

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected