fixed bug at cleanup and removed the surface from the swapchain struct
authorEleni Maria Stea <estea@igalia.com>
Sat, 18 Sep 2021 17:41:05 +0000 (20:41 +0300)
committerEleni Maria Stea <estea@igalia.com>
Sat, 18 Sep 2021 17:41:05 +0000 (20:41 +0300)
src/main.c
src/vk.c
src/vk.h

index eb1cf18..36d26e1 100644 (file)
@@ -262,8 +262,8 @@ cleanup(void)
     }
 
     vk_destroy_image(&vk_core, &vk_depth_att.obj);
-    vk_destroy_renderer(&vk_core, &vk_rnd);
     vk_destroy_semaphores(&vk_core, &vk_sema);
+    vk_destroy_renderer(&vk_core, &vk_rnd);
 
     if (vk_chain.swapchain) {
         vk_destroy_swapchain(&vk_core, &vk_chain);
index 9e80dd3..bde9972 100644 (file)
--- a/src/vk.c
+++ b/src/vk.c
@@ -1064,7 +1064,7 @@ are_props_supported(struct vk_ctx *ctx, struct vk_att_props *props)
 
 static bool
 sc_validate_surface(struct vk_ctx *ctx,
-                 VkSurfaceKHR surf)
+                    VkSurfaceKHR surf)
 {
     VkBool32 supported;
     if (!surf) {
@@ -2037,7 +2037,6 @@ vk_create_swapchain(struct vk_ctx *ctx,
     }
 
     memset(swapchain, 0, sizeof *swapchain);
-    swapchain->surface = surf;
 
     memset(&s_info, 0, sizeof s_info);
     s_info.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
@@ -2157,9 +2156,6 @@ vk_destroy_swapchain(struct vk_ctx *ctx,
                      struct vk_swapchain *swapchain)
 {
     vkDestroySwapchainKHR(ctx->dev, swapchain->swapchain, 0);
-    vkDestroySurfaceKHR(ctx->inst, swapchain->surface, 0);
-
-    free(swapchain);
     swapchain = 0;
 }
 
index dfe6aa6..6d4b05e 100644 (file)
--- a/src/vk.h
+++ b/src/vk.h
@@ -31,7 +31,6 @@ struct vk_cmd_buffer
 struct vk_swapchain
 {
     VkSwapchainKHR swapchain;
-    VkSurfaceKHR surface;
     VkSurfaceFormatKHR surf_fmt;
 
     /* image properties */