fixed bug at cleanup and removed the surface from the swapchain struct
[vkrt] / src / vk.c
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;
 }