@@ -403,8 +403,6 @@ static VkResult X11DRV_vkAcquireNextImageKHR(VkDevice device,
403
403
VkSwapchainKHR swapchain , uint64_t timeout , VkSemaphore semaphore ,
404
404
VkFence fence , uint32_t * image_index )
405
405
{
406
- static int once ;
407
- struct x11drv_escape_present_drawable escape ;
408
406
struct wine_vk_surface * surface = NULL ;
409
407
VkResult result ;
410
408
VkFence orig_fence ;
@@ -439,12 +437,6 @@ static VkResult X11DRV_vkAcquireNextImageKHR(VkDevice device,
439
437
if ((result == VK_SUCCESS || result == VK_SUBOPTIMAL_KHR ) && hdc && surface && surface -> offscreen )
440
438
{
441
439
if (wait_fence ) pvkWaitForFences (device , 1 , & fence , 0 , timeout );
442
- escape .code = X11DRV_PRESENT_DRAWABLE ;
443
- escape .drawable = surface -> window ;
444
- escape .flush = TRUE;
445
- ExtEscape (hdc , X11DRV_ESCAPE , sizeof (escape ), (char * )& escape , 0 , NULL );
446
- if (surface -> present_mode == VK_PRESENT_MODE_MAILBOX_KHR )
447
- if (once ++ ) FIXME ("Application requires child window rendering with mailbox present mode, expect possible tearing!\n" );
448
440
}
449
441
450
442
if (fence != orig_fence ) pvkDestroyFence (device , fence , NULL );
@@ -868,6 +860,15 @@ static VkResult X11DRV_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *
868
860
{
869
861
VkResult res ;
870
862
863
+ VkSwapchainKHR swapchain ;
864
+
865
+ static int once ;
866
+ struct x11drv_escape_present_drawable escape ;
867
+ struct wine_vk_surface * surface = NULL ;
868
+ VkFence orig_fence ;
869
+ BOOL wait_fence = FALSE;
870
+ HDC hdc = 0 ;
871
+
871
872
TRACE ("%p, %p\n" , queue , present_info );
872
873
873
874
res = pvkQueuePresentKHR (queue , present_info );
@@ -893,6 +894,31 @@ static VkResult X11DRV_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *
893
894
}
894
895
}
895
896
897
+ if (res == VK_SUCCESS ) {
898
+ for (uint32_t i = 0 ; i < present_info -> swapchainCount ; i ++ ) {
899
+ swapchain = present_info -> pSwapchains [i ];
900
+
901
+ EnterCriticalSection (& context_section );
902
+ if (!XFindContext (gdi_display , (XID )swapchain , vulkan_swapchain_context , (char * * )& surface ))
903
+ {
904
+ wine_vk_surface_grab (surface );
905
+ hdc = surface -> hdc ;
906
+ }
907
+ LeaveCriticalSection (& context_section );
908
+
909
+ if (hdc && surface && surface -> offscreen )
910
+ {
911
+ escape .code = X11DRV_PRESENT_DRAWABLE ;
912
+ escape .drawable = surface -> window ;
913
+ escape .flush = TRUE;
914
+
915
+ ExtEscape (hdc , X11DRV_ESCAPE , sizeof (escape ), (char * )& escape , 0 , NULL );
916
+ if (surface -> present_mode == VK_PRESENT_MODE_MAILBOX_KHR )
917
+ if (once ++ ) FIXME ("Application requires child window rendering with mailbox present mode, expect possible tearing!\n" );
918
+ }
919
+ }
920
+ }
921
+
896
922
return res ;
897
923
}
898
924
0 commit comments