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

Method cleanup

code/30_multisampling.cpp:285–333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected