/
0005_woff-hack.patch
152 lines (130 loc) · 5.31 KB
/
0005_woff-hack.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
From 3364858c693491ed510dbe0066a2dec692bc2965 Mon Sep 17 00:00:00 2001
From: Felix Hädicke <felixhaedicke at web.de>
Date: Sat, 25 Apr 2020 16:44:16 +0200
Subject: Woff Patch
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45277
Signed-off-by: Felix Hädicke <felixhaedicke at web.de>
Changes in v2:
- add missing XUniqueContext() initialisation for vulkan_swapchain_surface_context
---
dlls/winex11.drv/vulkan.c | 60 +++++++++++++++++++++++++++++++++------
1 file changed, 51 insertions(+), 9 deletions(-)
diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c
index 5c5c459..de14eda 100644
--- a/dlls/winex11.drv/vulkan.c
+++ b/dlls/winex11.drv/vulkan.c
@@ -32,6 +32,7 @@
#include "wine/debug.h"
#include "wine/heap.h"
#include "x11drv.h"
+#include "xcomposite.h"
#define VK_NO_PROTOTYPES
#define WINE_VK_HOST
@@ -56,6 +57,7 @@ static CRITICAL_SECTION_DEBUG critsect_debug =
static CRITICAL_SECTION context_section = { &critsect_debug, -1, 0, 0, 0, 0 };
static XContext vulkan_hwnd_context;
+static XContext vulkan_swapchain_surface_context;
#define VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR 1000004000
@@ -63,6 +65,7 @@ struct wine_vk_surface
{
LONG ref;
Window window;
+ HDC child_window_dc;
VkSurfaceKHR surface; /* native surface */
};
@@ -148,6 +151,7 @@ static BOOL WINAPI wine_vk_init(INIT_ONCE *once, void *param, void **context)
#undef LOAD_OPTIONAL_FUNCPTR
vulkan_hwnd_context = XUniqueContext();
+ vulkan_swapchain_surface_context = XUniqueContext();
return TRUE;
@@ -265,16 +269,24 @@ static VkResult X11DRV_vkCreateSwapchainKHR(VkDevice device,
const VkSwapchainCreateInfoKHR *create_info,
const VkAllocationCallbacks *allocator, VkSwapchainKHR *swapchain)
{
+ VkResult res;
VkSwapchainCreateInfoKHR create_info_host;
+ struct wine_vk_surface *x11_surface = surface_from_handle(create_info->surface);
+
TRACE("%p %p %p %p\n", device, create_info, allocator, swapchain);
if (allocator)
FIXME("Support for allocation callbacks not implemented yet\n");
create_info_host = *create_info;
- create_info_host.surface = surface_from_handle(create_info->surface)->surface;
+ create_info_host.surface = x11_surface->surface;
- return pvkCreateSwapchainKHR(device, &create_info_host, NULL /* allocator */, swapchain);
+ res = pvkCreateSwapchainKHR(device, &create_info_host, NULL /* allocator */, swapchain);
+ if (res == VK_SUCCESS)
+ {
+ XSaveContext(gdi_display, (XID)(*swapchain), vulkan_swapchain_surface_context, (char *)x11_surface);
+ }
+ return res;
}
static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance,
@@ -290,13 +302,6 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance,
if (allocator)
FIXME("Support for allocation callbacks not implemented yet\n");
- /* TODO: support child window rendering. */
- if (GetAncestor(create_info->hwnd, GA_PARENT) != GetDesktopWindow())
- {
- FIXME("Application requires child window rendering, which is not implemented yet!\n");
- return VK_ERROR_INCOMPATIBLE_DRIVER;
- }
-
x11_surface = heap_alloc_zero(sizeof(*x11_surface));
if (!x11_surface)
return VK_ERROR_OUT_OF_HOST_MEMORY;
@@ -313,6 +318,27 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance,
goto err;
}
+ /* child window rendering. */
+ if (GetAncestor(create_info->hwnd, GA_PARENT) != GetDesktopWindow())
+ {
+#ifdef SONAME_LIBXCOMPOSITE
+ if (usexcomposite)
+ {
+ pXCompositeRedirectWindow(gdi_display, x11_surface->window, CompositeRedirectManual);
+ x11_surface->child_window_dc = GetDC(create_info->hwnd);
+ }
+#else
+ if (0)
+ {
+ }
+#endif
+ else
+ {
+ FIXME("Child window rendering is not supported without X Composite Extension!\n");
+ return VK_ERROR_INCOMPATIBLE_DRIVER;
+ }
+ }
+
create_info_host.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR;
create_info_host.pNext = NULL;
create_info_host.flags = 0; /* reserved */
@@ -382,6 +408,7 @@ static void X11DRV_vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapcha
FIXME("Support for allocation callbacks not implemented yet\n");
pvkDestroySwapchainKHR(device, swapchain, NULL /* allocator */);
+ XDeleteContext(gdi_display, (XID)swapchain, vulkan_swapchain_surface_context);
}
static VkResult X11DRV_vkEnumerateInstanceExtensionProperties(const char *layer_name,
@@ -608,6 +635,21 @@ static VkResult X11DRV_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *
}
}
+ for (uint32_t i = 0 ; i < present_info->swapchainCount; ++i)
+ {
+ struct wine_vk_surface *x11_surface;
+ if (!XFindContext(gdi_display, (XID)present_info->pSwapchains[i],
+ vulkan_swapchain_surface_context, (char **)&x11_surface) &&
+ x11_surface->child_window_dc)
+ {
+ struct x11drv_escape_flush_gl_drawable escape;
+ escape.code = X11DRV_FLUSH_GL_DRAWABLE;
+ escape.gl_drawable = x11_surface->window;
+ escape.flush = TRUE;
+ ExtEscape(x11_surface->child_window_dc, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL);
+ }
+ }
+
return res;
}
--
2.17.1