@@ -1344,9 +1344,7 @@ static void vulkan_acquire_clear_fences(gfx_ctx_vulkan_data_t *vk)
13441344 {
13451345 struct vulkan_context * ctx = & vk -> context ;
13461346 VkSemaphore sem = vk -> context .swapchain_wait_semaphores [i ];
1347- #ifdef DEBUG
1348- retro_assert (ctx -> num_recycled_acquire_semaphores < VULKAN_MAX_SWAPCHAIN_IMAGES );
1349- #endif
1347+ assert (ctx -> num_recycled_acquire_semaphores < VULKAN_MAX_SWAPCHAIN_IMAGES );
13501348 ctx -> swapchain_recycled_semaphores [ctx -> num_recycled_acquire_semaphores ++ ] = sem ;
13511349 }
13521350 vk -> context .swapchain_wait_semaphores [i ] = VK_NULL_HANDLE ;
@@ -1408,9 +1406,7 @@ static void vulkan_acquire_wait_fences(gfx_ctx_vulkan_data_t *vk)
14081406 {
14091407 struct vulkan_context * ctx = & vk -> context ;
14101408 VkSemaphore sem = vk -> context .swapchain_wait_semaphores [index ];
1411- #ifdef DEBUG
1412- retro_assert (ctx -> num_recycled_acquire_semaphores < VULKAN_MAX_SWAPCHAIN_IMAGES );
1413- #endif
1409+ assert (ctx -> num_recycled_acquire_semaphores < VULKAN_MAX_SWAPCHAIN_IMAGES );
14141410 ctx -> swapchain_recycled_semaphores [ctx -> num_recycled_acquire_semaphores ++ ] = sem ;
14151411 }
14161412 vk -> context .swapchain_wait_semaphores [index ] = VK_NULL_HANDLE ;
@@ -1473,10 +1469,8 @@ bool vulkan_buffer_chain_alloc(const struct vulkan_context *context,
14731469
14741470 chain -> current = chain -> current -> next ;
14751471 chain -> offset = 0 ;
1476- #ifdef DEBUG
14771472 /* This cannot possibly fail. */
14781473 retro_assert (vulkan_buffer_chain_suballoc (chain , len , range ));
1479- #endif
14801474 }
14811475 return true;
14821476}
@@ -1603,16 +1597,15 @@ VkDescriptorSet vulkan_descriptor_manager_alloc(
16031597 }
16041598
16051599 manager -> current -> next = vulkan_alloc_descriptor_pool (device , manager );
1606- #ifdef DEBUG
16071600 retro_assert (manager -> current -> next );
1608- #endif
16091601
16101602 manager -> current = manager -> current -> next ;
16111603 manager -> count = 0 ;
16121604 }
16131605 return manager -> current -> sets [manager -> count ++ ];
16141606}
16151607
1608+
16161609bool vulkan_surface_create (gfx_ctx_vulkan_data_t * vk ,
16171610 enum vulkan_wsi_type type ,
16181611 void * display , void * surface ,
@@ -1879,9 +1872,7 @@ void vulkan_acquire_next_image(gfx_ctx_vulkan_data_t *vk)
18791872 }
18801873 }
18811874
1882- #ifdef DEBUG
18831875 retro_assert (!(vk -> context .flags & VK_CTX_FLAG_HAS_ACQUIRED_SWAPCHAIN ));
1884- #endif
18851876
18861877 if (vk -> flags & VK_DATA_FLAG_EMULATING_MAILBOX )
18871878 {
@@ -1912,16 +1903,16 @@ void vulkan_acquire_next_image(gfx_ctx_vulkan_data_t *vk)
19121903 vkWaitForFences (vk -> context .device , 1 , & fence , true, UINT64_MAX );
19131904 vk -> context .flags |= VK_CTX_FLAG_HAS_ACQUIRED_SWAPCHAIN ;
19141905
1915- /* Recycle the previous acquire semaphore rather than stalling the device.
1916- * vkDeviceWaitIdle here was a significant hot-path bottleneck. */
1917- if (vk -> context .swapchain_acquire_semaphore != VK_NULL_HANDLE )
1906+ if (vk -> context .swapchain_acquire_semaphore )
19181907 {
1919- struct vulkan_context * ctx = & vk -> context ;
1920- #ifdef DEBUG
1921- retro_assert (ctx -> num_recycled_acquire_semaphores < VULKAN_MAX_SWAPCHAIN_IMAGES );
1908+ #ifdef HAVE_THREADS
1909+ slock_lock (vk -> context .queue_lock );
1910+ #endif
1911+ vkDeviceWaitIdle (vk -> context .device );
1912+ vkDestroySemaphore (vk -> context .device , vk -> context .swapchain_acquire_semaphore , NULL );
1913+ #ifdef HAVE_THREADS
1914+ slock_unlock (vk -> context .queue_lock );
19221915#endif
1923- ctx -> swapchain_recycled_semaphores [ctx -> num_recycled_acquire_semaphores ++ ] =
1924- vk -> context .swapchain_acquire_semaphore ;
19251916 }
19261917 vk -> context .swapchain_acquire_semaphore = semaphore ;
19271918 }
@@ -1932,9 +1923,7 @@ void vulkan_acquire_next_image(gfx_ctx_vulkan_data_t *vk)
19321923 {
19331924 struct vulkan_context * ctx = & vk -> context ;
19341925 VkSemaphore sem = semaphore ;
1935- #ifdef DEBUG
1936- retro_assert (ctx -> num_recycled_acquire_semaphores < VULKAN_MAX_SWAPCHAIN_IMAGES );
1937- #endif
1926+ assert (ctx -> num_recycled_acquire_semaphores < VULKAN_MAX_SWAPCHAIN_IMAGES );
19381927 ctx -> swapchain_recycled_semaphores [ctx -> num_recycled_acquire_semaphores ++ ] = sem ;
19391928 }
19401929 }
0 commit comments