Skip to content

Commit

Permalink
winex11: Moved child window buffer copy to vkQueuePresentKHR
Browse files Browse the repository at this point in the history
  • Loading branch information
pac85 committed Jun 27, 2022
1 parent a7618ab commit 47b4060
Showing 1 changed file with 34 additions and 8 deletions.
42 changes: 34 additions & 8 deletions dlls/winex11.drv/vulkan.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,6 @@ static VkResult X11DRV_vkAcquireNextImageKHR(VkDevice device,
VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore,
VkFence fence, uint32_t *image_index)
{
static int once;
struct x11drv_escape_present_drawable escape;
struct wine_vk_surface *surface = NULL;
VkResult result;
VkFence orig_fence;
Expand Down Expand Up @@ -439,12 +437,6 @@ static VkResult X11DRV_vkAcquireNextImageKHR(VkDevice device,
if ((result == VK_SUCCESS || result == VK_SUBOPTIMAL_KHR) && hdc && surface && surface->offscreen)
{
if (wait_fence) pvkWaitForFences(device, 1, &fence, 0, timeout);
escape.code = X11DRV_PRESENT_DRAWABLE;
escape.drawable = surface->window;
escape.flush = TRUE;
ExtEscape(hdc, X11DRV_ESCAPE, sizeof(escape), (char *)&escape, 0, NULL);
if (surface->present_mode == VK_PRESENT_MODE_MAILBOX_KHR)
if (once++) FIXME("Application requires child window rendering with mailbox present mode, expect possible tearing!\n");
}

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

VkSwapchainKHR swapchain;

static int once;
struct x11drv_escape_present_drawable escape;
struct wine_vk_surface *surface = NULL;
VkFence orig_fence;
BOOL wait_fence = FALSE;
HDC hdc = 0;

TRACE("%p, %p\n", queue, present_info);

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

if(res == VK_SUCCESS) {
for(uint32_t i = 0; i < present_info->swapchainCount; i++) {
swapchain = present_info->pSwapchains[i];

EnterCriticalSection(&context_section);
if (!XFindContext(gdi_display, (XID)swapchain, vulkan_swapchain_context, (char **)&surface))
{
wine_vk_surface_grab(surface);
hdc = surface->hdc;
}
LeaveCriticalSection(&context_section);

if (hdc && surface && surface->offscreen)
{
escape.code = X11DRV_PRESENT_DRAWABLE;
escape.drawable = surface->window;
escape.flush = TRUE;

ExtEscape(hdc, X11DRV_ESCAPE, sizeof(escape), (char *)&escape, 0, NULL);
if (surface->present_mode == VK_PRESENT_MODE_MAILBOX_KHR)
if (once++) FIXME("Application requires child window rendering with mailbox present mode, expect possible tearing!\n");
}
}
}

return res;
}

Expand Down

0 comments on commit 47b4060

Please sign in to comment.