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

Method cleanup

code/24_texture_image.cpp:241–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239 }
240
241 void cleanup() {
242 cleanupSwapChain();
243
244 vkDestroyPipeline(device, graphicsPipeline, nullptr);
245 vkDestroyPipelineLayout(device, pipelineLayout, nullptr);
246 vkDestroyRenderPass(device, renderPass, nullptr);
247
248 for (size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++) {
249 vkDestroyBuffer(device, uniformBuffers[i], nullptr);
250 vkFreeMemory(device, uniformBuffersMemory[i], nullptr);
251 }
252
253 vkDestroyDescriptorPool(device, descriptorPool, nullptr);
254
255 vkDestroyImage(device, textureImage, nullptr);
256 vkFreeMemory(device, textureImageMemory, nullptr);
257
258 vkDestroyDescriptorSetLayout(device, descriptorSetLayout, nullptr);
259
260 vkDestroyBuffer(device, indexBuffer, nullptr);
261 vkFreeMemory(device, indexBufferMemory, nullptr);
262
263 vkDestroyBuffer(device, vertexBuffer, nullptr);
264 vkFreeMemory(device, vertexBufferMemory, nullptr);
265
266 for (size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++) {
267 vkDestroySemaphore(device, renderFinishedSemaphores[i], nullptr);
268 vkDestroySemaphore(device, imageAvailableSemaphores[i], nullptr);
269 vkDestroyFence(device, inFlightFences[i], nullptr);
270 }
271
272 vkDestroyCommandPool(device, commandPool, nullptr);
273
274 vkDestroyDevice(device, nullptr);
275
276 if (enableValidationLayers) {
277 DestroyDebugUtilsMessengerEXT(instance, debugMessenger, nullptr);
278 }
279
280 vkDestroySurfaceKHR(instance, surface, nullptr);
281 vkDestroyInstance(instance, nullptr);
282
283 glfwDestroyWindow(window);
284
285 glfwTerminate();
286 }
287
288 void recreateSwapChain() {
289 int width = 0, height = 0;

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected