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

Method cleanup

code/27_depth_buffering.cpp:267–315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected