| 203 | } |
| 204 | |
| 205 | void cleanup() { |
| 206 | cleanupSwapChain(); |
| 207 | |
| 208 | vkDestroyPipeline(device, graphicsPipeline, nullptr); |
| 209 | vkDestroyPipelineLayout(device, pipelineLayout, nullptr); |
| 210 | vkDestroyRenderPass(device, renderPass, nullptr); |
| 211 | |
| 212 | vkDestroyBuffer(device, vertexBuffer, nullptr); |
| 213 | vkFreeMemory(device, vertexBufferMemory, nullptr); |
| 214 | |
| 215 | for (size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++) { |
| 216 | vkDestroySemaphore(device, renderFinishedSemaphores[i], nullptr); |
| 217 | vkDestroySemaphore(device, imageAvailableSemaphores[i], nullptr); |
| 218 | vkDestroyFence(device, inFlightFences[i], nullptr); |
| 219 | } |
| 220 | |
| 221 | vkDestroyCommandPool(device, commandPool, nullptr); |
| 222 | |
| 223 | vkDestroyDevice(device, nullptr); |
| 224 | |
| 225 | if (enableValidationLayers) { |
| 226 | DestroyDebugUtilsMessengerEXT(instance, debugMessenger, nullptr); |
| 227 | } |
| 228 | |
| 229 | vkDestroySurfaceKHR(instance, surface, nullptr); |
| 230 | vkDestroyInstance(instance, nullptr); |
| 231 | |
| 232 | glfwDestroyWindow(window); |
| 233 | |
| 234 | glfwTerminate(); |
| 235 | } |
| 236 | |
| 237 | void recreateSwapChain() { |
| 238 | int width = 0, height = 0; |
nothing calls this directly
no test coverage detected