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