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

Method cleanup

code/28_model_loading.cpp:274–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected