Skip to content

Commit 47b4060

Browse files
committed
winex11: Moved child window buffer copy to vkQueuePresentKHR
1 parent a7618ab commit 47b4060

File tree

1 file changed

+34
-8
lines changed

1 file changed

+34
-8
lines changed

dlls/winex11.drv/vulkan.c

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,6 @@ static VkResult X11DRV_vkAcquireNextImageKHR(VkDevice device,
403403
VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore,
404404
VkFence fence, uint32_t *image_index)
405405
{
406-
static int once;
407-
struct x11drv_escape_present_drawable escape;
408406
struct wine_vk_surface *surface = NULL;
409407
VkResult result;
410408
VkFence orig_fence;
@@ -439,12 +437,6 @@ static VkResult X11DRV_vkAcquireNextImageKHR(VkDevice device,
439437
if ((result == VK_SUCCESS || result == VK_SUBOPTIMAL_KHR) && hdc && surface && surface->offscreen)
440438
{
441439
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");
448440
}
449441

450442
if (fence != orig_fence) pvkDestroyFence(device, fence, NULL);
@@ -868,6 +860,15 @@ static VkResult X11DRV_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *
868860
{
869861
VkResult res;
870862

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+
871872
TRACE("%p, %p\n", queue, present_info);
872873

873874
res = pvkQueuePresentKHR(queue, present_info);
@@ -893,6 +894,31 @@ static VkResult X11DRV_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *
893894
}
894895
}
895896

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+
896922
return res;
897923
}
898924

0 commit comments

Comments
 (0)