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

Method cleanup

code/22_descriptor_set_layout.cpp:229–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227 }
228
229 void cleanup() {
230 cleanupSwapChain();
231
232 vkDestroyPipeline(device, graphicsPipeline, nullptr);
233 vkDestroyPipelineLayout(device, pipelineLayout, nullptr);
234 vkDestroyRenderPass(device, renderPass, nullptr);
235
236 for (size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++) {
237 vkDestroyBuffer(device, uniformBuffers[i], nullptr);
238 vkFreeMemory(device, uniformBuffersMemory[i], nullptr);
239 }
240
241 vkDestroyDescriptorSetLayout(device, descriptorSetLayout, nullptr);
242
243 vkDestroyBuffer(device, indexBuffer, nullptr);
244 vkFreeMemory(device, indexBufferMemory, nullptr);
245
246 vkDestroyBuffer(device, vertexBuffer, nullptr);
247 vkFreeMemory(device, vertexBufferMemory, nullptr);
248
249 for (size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++) {
250 vkDestroySemaphore(device, renderFinishedSemaphores[i], nullptr);
251 vkDestroySemaphore(device, imageAvailableSemaphores[i], nullptr);
252 vkDestroyFence(device, inFlightFences[i], nullptr);
253 }
254
255 vkDestroyCommandPool(device, commandPool, nullptr);
256
257 vkDestroyDevice(device, nullptr);
258
259 if (enableValidationLayers) {
260 DestroyDebugUtilsMessengerEXT(instance, debugMessenger, nullptr);
261 }
262
263 vkDestroySurfaceKHR(instance, surface, nullptr);
264 vkDestroyInstance(instance, nullptr);
265
266 glfwDestroyWindow(window);
267
268 glfwTerminate();
269 }
270
271 void recreateSwapChain() {
272 int width = 0, height = 0;

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected