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

Method cleanup

code/26_texture_mapping.cpp:251–299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249 }
250
251 void cleanup() {
252 cleanupSwapChain();
253
254 vkDestroyPipeline(device, graphicsPipeline, nullptr);
255 vkDestroyPipelineLayout(device, pipelineLayout, nullptr);
256 vkDestroyRenderPass(device, renderPass, nullptr);
257
258 for (size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++) {
259 vkDestroyBuffer(device, uniformBuffers[i], nullptr);
260 vkFreeMemory(device, uniformBuffersMemory[i], nullptr);
261 }
262
263 vkDestroyDescriptorPool(device, descriptorPool, nullptr);
264
265 vkDestroySampler(device, textureSampler, nullptr);
266 vkDestroyImageView(device, textureImageView, nullptr);
267
268 vkDestroyImage(device, textureImage, nullptr);
269 vkFreeMemory(device, textureImageMemory, nullptr);
270
271 vkDestroyDescriptorSetLayout(device, descriptorSetLayout, nullptr);
272
273 vkDestroyBuffer(device, indexBuffer, nullptr);
274 vkFreeMemory(device, indexBufferMemory, nullptr);
275
276 vkDestroyBuffer(device, vertexBuffer, nullptr);
277 vkFreeMemory(device, vertexBufferMemory, nullptr);
278
279 for (size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++) {
280 vkDestroySemaphore(device, renderFinishedSemaphores[i], nullptr);
281 vkDestroySemaphore(device, imageAvailableSemaphores[i], nullptr);
282 vkDestroyFence(device, inFlightFences[i], nullptr);
283 }
284
285 vkDestroyCommandPool(device, commandPool, nullptr);
286
287 vkDestroyDevice(device, nullptr);
288
289 if (enableValidationLayers) {
290 DestroyDebugUtilsMessengerEXT(instance, debugMessenger, nullptr);
291 }
292
293 vkDestroySurfaceKHR(instance, surface, nullptr);
294 vkDestroyInstance(instance, nullptr);
295
296 glfwDestroyWindow(window);
297
298 glfwTerminate();
299 }
300
301 void recreateSwapChain() {
302 int width = 0, height = 0;

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected