@@ -3672,7 +3672,10 @@ pl_create_swapchain(plDevice* ptDevice, plSurface* ptSurface, const plSwapchainI
36723672 .sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO
36733673 };
36743674 for (uint32_t i = 0 ; i < gptGraphics -> uFramesInFlight ; i ++ )
3675+ {
36753676 PL_VULKAN (vkCreateSemaphore (ptDevice -> tLogicalDevice , & tSemaphoreInfo , gptGraphics -> ptAllocationCallbacks , & ptSwap -> atImageAvailable [i ]));
3677+ pl__set_vulkan_object_name (ptDevice , (uint64_t )ptSwap -> atImageAvailable [i ], VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT , "image available" );
3678+ }
36763679 return ptSwap ;
36773680}
36783681
@@ -3830,9 +3833,14 @@ void
38303833pl_recreate_swapchain (plSwapchain * ptSwap , const plSwapchainInit * ptInit )
38313834{
38323835 pl_begin_cpu_sample (gptProfile , 0 , __FUNCTION__ );
3836+
3837+ plDevice * ptDevice = ptSwap -> ptDevice ;
3838+ VkSurfaceCapabilitiesKHR tCapabilities = {0 };
3839+ PL_VULKAN (vkGetPhysicalDeviceSurfaceCapabilitiesKHR (ptDevice -> tPhysicalDevice , ptSwap -> ptSurface -> tSurface , & tCapabilities ));
3840+
38333841 ptSwap -> tInfo .bVSync = ptInit -> bVSync ;
3834- ptSwap -> tInfo .uWidth = ptInit -> uWidth ;
3835- ptSwap -> tInfo .uHeight = ptInit -> uHeight ;
3842+ ptSwap -> tInfo .uWidth = tCapabilities . currentExtent . width ;
3843+ ptSwap -> tInfo .uHeight = tCapabilities . currentExtent . height ;
38363844 ptSwap -> tInfo .tSampleCount = pl_min (ptInit -> tSampleCount , ptSwap -> ptDevice -> tInfo .tMaxSampleCount );
38373845 if (ptSwap -> tInfo .tSampleCount == 0 )
38383846 ptSwap -> tInfo .tSampleCount = 1 ;
@@ -5185,11 +5193,17 @@ pl__create_swapchain(uint32_t uWidth, uint32_t uHeight, plSwapchain* ptSwap)
51855193 .sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO
51865194 };
51875195
5188- const uint32_t uNewSemaphoreCount = ptSwap -> uImageCount - pl_sb_size (ptSwap -> sbtRenderFinish );
5189- for (uint32_t i = 0 ; i < uNewSemaphoreCount ; i ++ )
5196+ for (uint32_t i = 0 ; i < pl_sb_size (ptSwap -> sbtRenderFinish ); i ++ )
5197+ {
5198+ vkDestroySemaphore (ptDevice -> tLogicalDevice , ptSwap -> sbtRenderFinish [i ], gptGraphics -> ptAllocationCallbacks );
5199+ }
5200+ pl_sb_reset (ptSwap -> sbtRenderFinish );
5201+
5202+ for (uint32_t i = 0 ; i < ptSwap -> uImageCount ; i ++ )
51905203 {
51915204 pl_sb_add (ptSwap -> sbtRenderFinish );
51925205 PL_VULKAN (vkCreateSemaphore (ptDevice -> tLogicalDevice , & tSemaphoreInfo , gptGraphics -> ptAllocationCallbacks , & pl_sb_top (ptSwap -> sbtRenderFinish )));
5206+ pl__set_vulkan_object_name (ptDevice , (uint64_t )pl_sb_top (ptSwap -> sbtRenderFinish ), VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT , "render finish" );
51935207 }
51945208
51955209 for (uint32_t i = 0 ; i < ptSwap -> uImageCount ; i ++ )
0 commit comments