From: Etaash Mathamsetty <etaash.mathamsetty@gmail.com> --- dlls/winewayland.drv/wayland_surface.c | 28 +++++++++++++++++++++++--- dlls/winewayland.drv/waylanddrv.h | 2 ++ dlls/winewayland.drv/window.c | 1 + 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/dlls/winewayland.drv/wayland_surface.c b/dlls/winewayland.drv/wayland_surface.c index 644ad3b8559..78c387015f5 100644 --- a/dlls/winewayland.drv/wayland_surface.c +++ b/dlls/winewayland.drv/wayland_surface.c @@ -1238,15 +1238,35 @@ struct wayland_client_surface *impl_from_client_surface(struct client_surface *c return CONTAINING_RECORD(client, struct wayland_client_surface, client); } +struct wayland_client_surface *update_vulkan_client_surface(HWND hwnd, struct client_surface *client) +{ + struct wayland_win_data *data; + + if ((data = wayland_win_data_get(hwnd))) + { + if (client && !data->vulkan_client) data->vulkan_client = client; + else if (!client) client = data->vulkan_client; + wayland_win_data_release(data); + } + + if (client) + { + client_surface_add_ref(client); + return impl_from_client_surface(client); + } + + return NULL; +} + struct client_surface *WAYLAND_CreateClientSurface(HWND hwnd, int pixel_format, BOOL gl) { - struct wayland_client_surface *client; + struct wayland_client_surface *client = NULL; struct wl_region *empty_region; + if (!gl && (client = update_vulkan_client_surface(hwnd, NULL))) return &client->client; if (!(client = client_surface_create(sizeof(*client), &wayland_client_surface_funcs, hwnd))) return NULL; - client->wl_surface = - wl_compositor_create_surface(process_wayland.wl_compositor); + client->wl_surface = wl_compositor_create_surface(process_wayland.wl_compositor); if (!client->wl_surface) { ERR("Failed to create client wl_surface\n"); @@ -1273,6 +1293,8 @@ struct client_surface *WAYLAND_CreateClientSurface(HWND hwnd, int pixel_format, goto err; } + if (!gl) update_vulkan_client_surface(hwnd, &client->client); + return &client->client; err: diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h index 6e2f6ab5608..b027dd05cae 100644 --- a/dlls/winewayland.drv/waylanddrv.h +++ b/dlls/winewayland.drv/waylanddrv.h @@ -378,6 +378,8 @@ struct wayland_win_data struct wayland_surface *wayland_surface; /* wayland client surface (if any) for this window */ struct wayland_client_surface *client_surface; + /* dedicated client surface for vulkan apps on this window */ + struct client_surface *vulkan_client; /* window rects, relative to parent client area */ struct window_rects rects; BOOL is_fullscreen; diff --git a/dlls/winewayland.drv/window.c b/dlls/winewayland.drv/window.c index 54bb6000d94..98ca6f1fd13 100644 --- a/dlls/winewayland.drv/window.c +++ b/dlls/winewayland.drv/window.c @@ -99,6 +99,7 @@ static void wayland_win_data_destroy(struct wayland_win_data *data) pthread_mutex_unlock(&win_data_mutex); + if (data->vulkan_client) client_surface_release(data->vulkan_client); if (data->wayland_surface) wayland_surface_destroy(data->wayland_surface); if (data->window_contents) wayland_shm_buffer_unref(data->window_contents); free(data); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11342