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

Method cleanup

code/25_sampler.cpp:245–293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected