@@ -188,9 +188,18 @@ impl super::Swapchain {
188188 } ;
189189
190190 // We cannot take this by value, as the function returns `self`.
191- for semaphore in self . surface_semaphores . drain ( ..) {
191+ for semaphore in self . acquire_semaphores . drain ( ..) {
192192 let arc_removed = Arc :: into_inner ( semaphore) . expect (
193- "Trying to destroy a SurfaceSemaphores that is still in use by a SurfaceTexture" ,
193+ "Trying to destroy a SurfaceAcquireSemaphores that is still in use by a SurfaceTexture" ,
194+ ) ;
195+ let mutex_removed = arc_removed. into_inner ( ) ;
196+
197+ unsafe { mutex_removed. destroy ( device) } ;
198+ }
199+
200+ for semaphore in self . present_semaphores . drain ( ..) {
201+ let arc_removed = Arc :: into_inner ( semaphore) . expect (
202+ "Trying to destroy a SurfacePresentSemaphores that is still in use by a SurfaceTexture" ,
194203 ) ;
195204 let mutex_removed = arc_removed. into_inner ( ) ;
196205
@@ -1074,9 +1083,9 @@ impl crate::Surface for super::Surface {
10741083 timeout_ns = u64:: MAX ;
10751084 }
10761085
1077- let swapchain_semaphores_arc = swapchain. get_surface_semaphores ( ) ;
1086+ let acquire_semaphore_arc = swapchain. get_acquire_semaphore ( ) ;
10781087 // Nothing should be using this, so we don't block, but panic if we fail to lock.
1079- let locked_swapchain_semaphores = swapchain_semaphores_arc
1088+ let acquire_semaphore_guard = acquire_semaphore_arc
10801089 . try_lock ( )
10811090 . expect ( "Failed to lock a SwapchainSemaphores." ) ;
10821091
@@ -1095,7 +1104,7 @@ impl crate::Surface for super::Surface {
10951104 // `vkAcquireNextImageKHR` again.
10961105 swapchain. device . wait_for_fence (
10971106 fence,
1098- locked_swapchain_semaphores . previously_used_submission_index ,
1107+ acquire_semaphore_guard . previously_used_submission_index ,
10991108 timeout_ns,
11001109 ) ?;
11011110
@@ -1105,7 +1114,7 @@ impl crate::Surface for super::Surface {
11051114 swapchain. functor . acquire_next_image (
11061115 swapchain. raw ,
11071116 timeout_ns,
1108- locked_swapchain_semaphores . acquire ,
1117+ acquire_semaphore_guard . acquire ,
11091118 vk:: Fence :: null ( ) ,
11101119 )
11111120 } {
@@ -1129,12 +1138,12 @@ impl crate::Surface for super::Surface {
11291138 }
11301139 } ;
11311140
1132- log:: error!( "Got swapchain image {index}" ) ;
1133-
1134- drop ( locked_swapchain_semaphores) ;
1141+ drop ( acquire_semaphore_guard) ;
11351142 // We only advance the surface semaphores if we successfully acquired an image, otherwise
11361143 // we should try to re-acquire using the same semaphores.
1137- swapchain. advance_surface_semaphores ( ) ;
1144+ swapchain. advance_acquire_semaphore ( ) ;
1145+
1146+ let present_semaphore_arc = swapchain. get_present_semaphores ( index) ;
11381147
11391148 // special case for Intel Vulkan returning bizarre values (ugh)
11401149 if swapchain. device . vendor_id == crate :: auxil:: db:: intel:: VENDOR && index > 0x100 {
@@ -1158,7 +1167,8 @@ impl crate::Surface for super::Surface {
11581167 } ,
11591168 identity,
11601169 } ,
1161- surface_semaphores : swapchain_semaphores_arc,
1170+ acquire_semaphores : acquire_semaphore_arc,
1171+ present_semaphores : present_semaphore_arc,
11621172 } ;
11631173 Ok ( Some ( crate :: AcquiredSurfaceTexture {
11641174 texture,
0 commit comments