Commit dc7dcbee authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

win32u: Introduce a per-window vulkan surface list.

parent 1db35221
......@@ -77,6 +77,7 @@ typedef struct tagWND
UINT dpi; /* window DPI */
DPI_AWARENESS dpi_awareness; /* DPI awareness */
struct window_surface *surface; /* Window surface if any */
struct list vulkan_surfaces; /* list of vulkan surfaces created for this window */
struct tagDIALOGINFO *dlgInfo; /* Dialog additional info (dialogs only) */
int pixel_format; /* Pixel format set by the graphics driver */
int internal_pixel_format; /* Internal pixel format set via WGL_WINE_pixel_format_passthrough */
......@@ -254,6 +255,9 @@ extern BOOL set_keyboard_auto_repeat( BOOL enable );
/* systray.c */
extern LRESULT system_tray_call( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, void *data );
/* vulkan.c */
extern void vulkan_detach_surfaces( struct list *surfaces );
/* window.c */
HANDLE alloc_user_handle( struct user_object *ptr, unsigned int type );
void *free_user_handle( HANDLE handle, unsigned int type );
......
......@@ -30,6 +30,7 @@
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "win32u_private.h"
#include "ntuser_private.h"
#define VK_NO_PROTOTYPES
#define WINE_VK_HOST
......@@ -51,6 +52,7 @@ static void *(*p_vkGetInstanceProcAddr)(VkInstance, const char *);
struct surface
{
struct list entry;
VkSurfaceKHR host_surface;
void *driver_private;
HWND hwnd;
......@@ -71,6 +73,7 @@ static VkResult win32u_vkCreateWin32SurfaceKHR( VkInstance instance, const VkWin
{
struct surface *surface;
VkResult res;
WND *win;
TRACE( "instance %p, info %p, allocator %p, handle %p\n", instance, info, allocator, handle );
if (allocator) FIXME( "Support for allocation callbacks not implemented yet\n" );
......@@ -82,6 +85,14 @@ static VkResult win32u_vkCreateWin32SurfaceKHR( VkInstance instance, const VkWin
return res;
}
if (!(win = get_win_ptr( info->hwnd )) || win == WND_DESKTOP || win == WND_OTHER_PROCESS)
list_init( &surface->entry );
else
{
list_add_tail( &win->vulkan_surfaces, &surface->entry );
release_win_ptr( win );
}
surface->hwnd = info->hwnd;
*handle = surface_to_handle( surface );
return VK_SUCCESS;
......@@ -94,6 +105,7 @@ static void win32u_vkDestroySurfaceKHR( VkInstance instance, VkSurfaceKHR handle
TRACE( "instance %p, handle 0x%s, allocator %p\n", instance, wine_dbgstr_longlong(handle), allocator );
if (allocator) FIXME( "Support for allocation callbacks not implemented yet\n" );
list_remove( &surface->entry );
p_vkDestroySurfaceKHR( instance, surface->host_surface, NULL /* allocator */ );
driver_funcs->p_vulkan_surface_destroy( surface->hwnd, surface->driver_private );
free( surface );
......@@ -239,6 +251,17 @@ static void vulkan_init(void)
#undef LOAD_FUNCPTR
}
void vulkan_detach_surfaces( struct list *surfaces )
{
struct surface *surface;
LIST_FOR_EACH_ENTRY( surface, surfaces, struct surface, entry )
{
list_remove( &surface->entry );
list_init( &surface->entry );
}
}
/***********************************************************************
* __wine_get_vulkan_driver (win32u.so)
*/
......@@ -258,6 +281,10 @@ const struct vulkan_funcs *__wine_get_vulkan_driver( UINT version )
#else /* SONAME_LIBVULKAN */
void vulkan_detach_surfaces( struct list *surfaces )
{
}
/***********************************************************************
* __wine_get_vulkan_driver (win32u.so)
*/
......
......@@ -4705,6 +4705,7 @@ static void free_window_handle( HWND hwnd )
*/
LRESULT destroy_window( HWND hwnd )
{
struct list vulkan_surfaces = LIST_INIT(vulkan_surfaces);
struct window_surface *surface;
HMENU menu = 0, sys_menu;
WND *win;
......@@ -4751,6 +4752,7 @@ LRESULT destroy_window( HWND hwnd )
free_dce( win->dce, hwnd );
win->dce = NULL;
NtUserDestroyCursor( win->hIconSmall2, 0 );
list_move_tail( &vulkan_surfaces, &win->vulkan_surfaces );
surface = win->surface;
win->surface = NULL;
release_win_ptr( win );
......@@ -4763,6 +4765,7 @@ LRESULT destroy_window( HWND hwnd )
window_surface_release( surface );
}
vulkan_detach_surfaces( &vulkan_surfaces );
user_driver->pDestroyWindow( hwnd );
free_window_handle( hwnd );
......@@ -4885,6 +4888,8 @@ void destroy_thread_windows(void)
free_list = win->obj.handle;
TRACE( "destroying %p\n", win );
vulkan_detach_surfaces( &win->vulkan_surfaces );
if ((win->dwStyle & (WS_CHILD | WS_POPUP)) != WS_CHILD && win->wIDmenu)
NtUserDestroyMenu( UlongToHandle(win->wIDmenu) );
if (win->hSysMenu) NtUserDestroyMenu( win->hSysMenu );
......@@ -4987,6 +4992,7 @@ static WND *create_window_handle( HWND parent, HWND owner, UNICODE_STRING *name,
win->cbWndExtra = extra_bytes;
win->dpi = dpi;
win->dpi_awareness = awareness;
list_init( &win->vulkan_surfaces );
set_user_handle_ptr( handle, &win->obj );
if (is_winproc_unicode( win->winproc, !ansi )) win->flags |= WIN_ISUNICODE;
return win;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment