|
|
|
@ -3107,6 +3107,53 @@ void main_loop(GLFWwindow* window, VulkanContext* context) {
|
|
|
|
|
void cleanup(GLFWwindow* window, VulkanContext* context) {
|
|
|
|
|
if(context != 0) {
|
|
|
|
|
if(context->instance != VK_NULL_HANDLE) {
|
|
|
|
|
if(context->extra_graphics_pool != VK_NULL_HANDLE) {
|
|
|
|
|
vkDestroyCommandPool(context->device, context->extra_graphics_pool, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(context->render_pass != VK_NULL_HANDLE) {
|
|
|
|
|
vkDestroyRenderPass(context->device, context->render_pass, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(context->depth_image != VK_NULL_HANDLE) {
|
|
|
|
|
vkDestroyImage(context->device, context->depth_image, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(uint32_t i = 0; i < context->swapchain_image_count; i++) {
|
|
|
|
|
vkDestroyFramebuffer(context->device, context->swapchain_framebuffers[i], 0);
|
|
|
|
|
vkDestroyImageView(context->device, context->swapchain_image_views[i], 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(context->swapchain != VK_NULL_HANDLE) {
|
|
|
|
|
vkDestroySwapchainKHR(context->device, context->swapchain, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(uint32_t i = 0; i < context->max_frames_in_flight; i++) {
|
|
|
|
|
vkDestroySemaphore(context->device, context->image_available_semaphores[i], 0);
|
|
|
|
|
vkDestroySemaphore(context->device, context->render_finished_semaphores[i], 0);
|
|
|
|
|
vkDestroyFence(context->device, context->in_flight_fences[i], 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(context->depth_image_view != VK_NULL_HANDLE) {
|
|
|
|
|
vkDestroyImageView(context->device, context->depth_image_view, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(context->depth_image_memory != VK_NULL_HANDLE) {
|
|
|
|
|
vkFreeMemory(context->device, context->depth_image_memory, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(context->graphics_command_pool != VK_NULL_HANDLE) {
|
|
|
|
|
vkDestroyCommandPool(context->device, context->graphics_command_pool, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(context->transfer_command_pool != VK_NULL_HANDLE) {
|
|
|
|
|
vkDestroyCommandPool(context->device, context->transfer_command_pool, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(context->swapchain_command_buffers != NULL) {
|
|
|
|
|
free(context->swapchain_command_buffers);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(context->swapchain != VK_NULL_HANDLE) {
|
|
|
|
|
vkDestroySwapchainKHR(context->device, context->swapchain, 0);
|
|
|
|
|
}
|
|
|
|
|