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