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

Method cleanup

code/31_compute_shader.cpp:244–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected