From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/driver.c | 6 +-- dlls/win32u/vulkan.c | 73 +++++++++++++++++++++++++++---- dlls/winemac.drv/macdrv.h | 2 +- dlls/winemac.drv/vulkan.c | 33 +++++++------- dlls/winewayland.drv/vulkan.c | 51 ++++++++++----------- dlls/winewayland.drv/waylanddrv.h | 2 +- dlls/winex11.drv/vulkan.c | 33 +++++++------- dlls/winex11.drv/x11drv.h | 2 +- include/wine/gdi_driver.h | 4 +- include/wine/vulkan_driver.h | 12 ++++- 10 files changed, 140 insertions(+), 78 deletions(-)
diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index e55e9ee1b23..e5cd5e1757c 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c @@ -897,7 +897,7 @@ static BOOL nulldrv_SystemParametersInfo( UINT action, UINT int_param, void *ptr return FALSE; }
-static UINT nulldrv_VulkanInit( UINT version, void *vulkan_handle, struct vulkan_funcs *vulkan_funcs ) +static UINT nulldrv_VulkanInit( UINT version, void *vulkan_handle, struct vulkan_driver_funcs *driver_funcs ) { return STATUS_NOT_IMPLEMENTED; } @@ -1213,9 +1213,9 @@ static BOOL loaderdrv_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWI return load_driver()->pUpdateLayeredWindow( hwnd, info, window_rect ); }
-static UINT loaderdrv_VulkanInit( UINT version, void *vulkan_handle, struct vulkan_funcs *vulkan_funcs ) +static UINT loaderdrv_VulkanInit( UINT version, void *vulkan_handle, struct vulkan_driver_funcs *driver_funcs ) { - return load_driver()->pVulkanInit( version, vulkan_handle, vulkan_funcs ); + return load_driver()->pVulkanInit( version, vulkan_handle, driver_funcs ); }
static const struct user_driver_funcs lazy_load_driver = diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index b29a0edee0f..7c1d7dc50f0 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -41,6 +41,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(vulkan); #ifdef SONAME_LIBVULKAN
static void *vulkan_handle; +static struct vulkan_driver_funcs driver_funcs; static struct vulkan_funcs vulkan_funcs;
static VkResult (*p_vkQueuePresentKHR)(VkQueue, const VkPresentInfoKHR *); @@ -60,7 +61,7 @@ static VkResult win32u_vkQueuePresentKHR( VkQueue queue, const VkPresentInfoKHR for (i = 0; i < present_info->swapchainCount; i++) { VkResult swapchain_res = present_info->pResults ? present_info->pResults[i] : res; - vulkan_funcs.p_vulkan_surface_presented( surfaces[i], swapchain_res ); + driver_funcs.p_vulkan_surface_presented( surfaces[i], swapchain_res ); }
return res; @@ -70,7 +71,7 @@ static void *win32u_vkGetDeviceProcAddr( VkDevice device, const char *name ) { TRACE( "device %p, name %s\n", device, debugstr_a(name) );
- if (!strcmp( name, "vkGetDeviceProcAddr" )) return win32u_vkGetDeviceProcAddr; + if (!strcmp( name, "vkGetDeviceProcAddr" )) return vulkan_funcs.p_vkGetDeviceProcAddr; if (!strcmp( name, "vkQueuePresentKHR" )) return vulkan_funcs.p_vkQueuePresentKHR;
return p_vkGetDeviceProcAddr( device, name ); @@ -84,16 +85,63 @@ static void *win32u_vkGetInstanceProcAddr( VkInstance instance, const char *name
if (!strcmp( name, "vkCreateWin32SurfaceKHR" )) return vulkan_funcs.p_vkCreateWin32SurfaceKHR; if (!strcmp( name, "vkDestroySurfaceKHR" )) return vulkan_funcs.p_vkDestroySurfaceKHR; - if (!strcmp( name, "vkGetInstanceProcAddr" )) return win32u_vkGetInstanceProcAddr; + if (!strcmp( name, "vkGetInstanceProcAddr" )) return vulkan_funcs.p_vkGetInstanceProcAddr; if (!strcmp( name, "vkGetPhysicalDeviceWin32PresentationSupportKHR" )) return vulkan_funcs.p_vkGetPhysicalDeviceWin32PresentationSupportKHR;
/* vkGetInstanceProcAddr also loads any children of instance, so device functions as well. */ - if (!strcmp( name, "vkGetDeviceProcAddr" )) return win32u_vkGetDeviceProcAddr; + if (!strcmp( name, "vkGetDeviceProcAddr" )) return vulkan_funcs.p_vkGetDeviceProcAddr; if (!strcmp( name, "vkQueuePresentKHR" )) return vulkan_funcs.p_vkQueuePresentKHR;
return p_vkGetInstanceProcAddr( instance, name ); }
+static struct vulkan_funcs vulkan_funcs = +{ + .p_vkQueuePresentKHR = win32u_vkQueuePresentKHR, + .p_vkGetDeviceProcAddr = win32u_vkGetDeviceProcAddr, + .p_vkGetInstanceProcAddr = win32u_vkGetInstanceProcAddr, +}; + +static VkResult nulldrv_vkCreateWin32SurfaceKHR( VkInstance instance, const VkWin32SurfaceCreateInfoKHR *info, + const VkAllocationCallbacks *allocator, VkSurfaceKHR *surface ) +{ + FIXME( "stub!\n" ); + return VK_ERROR_INCOMPATIBLE_DRIVER; +} + +static void nulldrv_vkDestroySurfaceKHR( VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks *allocator ) +{ +} + +static void nulldrv_vulkan_surface_presented( HWND hwnd, VkResult result ) +{ +} + +static VkBool32 nulldrv_vkGetPhysicalDeviceWin32PresentationSupportKHR( VkPhysicalDevice device, uint32_t queue ) +{ + return VK_TRUE; +} + +static const char *nulldrv_get_host_surface_extension(void) +{ + return "VK_WINE_nulldrv_surface"; +} + +static VkSurfaceKHR nulldrv_wine_get_host_surface( VkSurfaceKHR surface ) +{ + return surface; +} + +static const struct vulkan_driver_funcs nulldrv_funcs = +{ + .p_vkCreateWin32SurfaceKHR = nulldrv_vkCreateWin32SurfaceKHR, + .p_vkDestroySurfaceKHR = nulldrv_vkDestroySurfaceKHR, + .p_vulkan_surface_presented = nulldrv_vulkan_surface_presented, + .p_vkGetPhysicalDeviceWin32PresentationSupportKHR = nulldrv_vkGetPhysicalDeviceWin32PresentationSupportKHR, + .p_get_host_surface_extension = nulldrv_get_host_surface_extension, + .p_wine_get_host_surface = nulldrv_wine_get_host_surface, +}; + static void vulkan_init(void) { UINT status; @@ -104,7 +152,7 @@ static void vulkan_init(void) return; }
- if ((status = user_driver->pVulkanInit( WINE_VULKAN_DRIVER_VERSION, vulkan_handle, &vulkan_funcs )) && + if ((status = user_driver->pVulkanInit( WINE_VULKAN_DRIVER_VERSION, vulkan_handle, &driver_funcs )) && status != STATUS_NOT_IMPLEMENTED) { ERR( "Failed to initialize the driver vulkan functions, status %#x\n", status ); @@ -113,6 +161,17 @@ static void vulkan_init(void) return; }
+ if (status == STATUS_NOT_IMPLEMENTED) + driver_funcs = nulldrv_funcs; + else + { + vulkan_funcs.p_vkCreateWin32SurfaceKHR = driver_funcs.p_vkCreateWin32SurfaceKHR; + vulkan_funcs.p_vkDestroySurfaceKHR = driver_funcs.p_vkDestroySurfaceKHR; + vulkan_funcs.p_vkGetPhysicalDeviceWin32PresentationSupportKHR = driver_funcs.p_vkGetPhysicalDeviceWin32PresentationSupportKHR; + vulkan_funcs.p_get_host_surface_extension = driver_funcs.p_get_host_surface_extension; + vulkan_funcs.p_wine_get_host_surface = driver_funcs.p_wine_get_host_surface; + } + #define LOAD_FUNCPTR( f ) \ if (!(p_##f = dlsym( vulkan_handle, #f ))) \ { \ @@ -126,10 +185,6 @@ static void vulkan_init(void) LOAD_FUNCPTR( vkGetInstanceProcAddr ); LOAD_FUNCPTR( vkQueuePresentKHR ); #undef LOAD_FUNCPTR - - vulkan_funcs.p_vkGetDeviceProcAddr = win32u_vkGetDeviceProcAddr; - vulkan_funcs.p_vkGetInstanceProcAddr = win32u_vkGetInstanceProcAddr; - vulkan_funcs.p_vkQueuePresentKHR = win32u_vkQueuePresentKHR; }
/*********************************************************************** diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index f5793006c35..133f9beb9e2 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -257,7 +257,7 @@ extern BOOL macdrv_SystemParametersInfo(UINT action, UINT int_param, void *ptr_p extern void macdrv_lost_pasteboard_ownership(HWND hwnd);
extern struct opengl_funcs *macdrv_wine_get_wgl_driver(UINT version); -extern UINT macdrv_VulkanInit(UINT version, void *vulkan_handle, struct vulkan_funcs *vulkan_funcs); +extern UINT macdrv_VulkanInit(UINT version, void *vulkan_handle, struct vulkan_driver_funcs *driver_funcs); extern void sync_gl_view(struct macdrv_win_data* data, const RECT* old_whole_rect, const RECT* old_client_rect);
extern CGImageRef create_cgimage_from_icon_bitmaps(HDC hdc, HANDLE icon, HBITMAP hbmColor, diff --git a/dlls/winemac.drv/vulkan.c b/dlls/winemac.drv/vulkan.c index ceae7714a60..3f7b12ca4ac 100644 --- a/dlls/winemac.drv/vulkan.c +++ b/dlls/winemac.drv/vulkan.c @@ -80,7 +80,7 @@ static VkResult (*pvkCreateMetalSurfaceEXT)(VkInstance, const VkMetalSurfaceCrea static void (*pvkDestroySurfaceKHR)(VkInstance, VkSurfaceKHR, const VkAllocationCallbacks *); static VkResult (*pvkGetPhysicalDeviceSurfaceCapabilities2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, VkSurfaceCapabilities2KHR *);
-static const struct vulkan_funcs vulkan_funcs; +static const struct vulkan_driver_funcs macdrv_vulkan_driver_funcs;
static inline struct wine_vk_surface *surface_from_handle(VkSurfaceKHR handle) { @@ -196,6 +196,10 @@ static void macdrv_vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface wine_vk_surface_destroy(instance, mac_surface); }
+static void macdrv_vulkan_surface_presented(HWND hwnd, VkResult result) +{ +} + static VkBool32 macdrv_vkGetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice phys_dev, uint32_t index) { @@ -218,25 +222,18 @@ static VkSurfaceKHR macdrv_wine_get_host_surface(VkSurfaceKHR surface) return mac_surface->host_surface; }
-static void macdrv_vulkan_surface_presented(HWND hwnd, VkResult result) +static const struct vulkan_driver_funcs macdrv_vulkan_driver_funcs = { -} + .p_vkCreateWin32SurfaceKHR = macdrv_vkCreateWin32SurfaceKHR, + .p_vkDestroySurfaceKHR = macdrv_vkDestroySurfaceKHR, + .p_vulkan_surface_presented = macdrv_vulkan_surface_presented,
-static const struct vulkan_funcs vulkan_funcs = -{ - macdrv_vkCreateWin32SurfaceKHR, - macdrv_vkDestroySurfaceKHR, - NULL, - NULL, - macdrv_vkGetPhysicalDeviceWin32PresentationSupportKHR, - NULL, - - macdrv_get_host_surface_extension, - macdrv_wine_get_host_surface, - macdrv_vulkan_surface_presented, + .p_vkGetPhysicalDeviceWin32PresentationSupportKHR = macdrv_vkGetPhysicalDeviceWin32PresentationSupportKHR, + .p_get_host_surface_extension = macdrv_get_host_surface_extension, + .p_wine_get_host_surface = macdrv_wine_get_host_surface, };
-UINT macdrv_VulkanInit(UINT version, void *vulkan_handle, struct vulkan_funcs *driver_funcs) +UINT macdrv_VulkanInit(UINT version, void *vulkan_handle, struct vulkan_driver_funcs *driver_funcs) { if (version != WINE_VULKAN_DRIVER_VERSION) { @@ -250,13 +247,13 @@ UINT macdrv_VulkanInit(UINT version, void *vulkan_handle, struct vulkan_funcs *d LOAD_FUNCPTR(vkDestroySurfaceKHR) #undef LOAD_FUNCPTR
- *driver_funcs = vulkan_funcs; + *driver_funcs = macdrv_vulkan_driver_funcs; return STATUS_SUCCESS; }
#else /* No vulkan */
-UINT macdrv_VulkanInit(UINT version, void *vulkan_handle, struct vulkan_funcs *driver_funcs) +UINT macdrv_VulkanInit(UINT version, void *vulkan_handle, struct vulkan_driver_funcs *driver_funcs) { ERR("Wine was built without Vulkan support.\n"); return STATUS_NOT_IMPLEMENTED; diff --git a/dlls/winewayland.drv/vulkan.c b/dlls/winewayland.drv/vulkan.c index 6e95fb4b0f6..bed974b4525 100644 --- a/dlls/winewayland.drv/vulkan.c +++ b/dlls/winewayland.drv/vulkan.c @@ -57,7 +57,7 @@ static VkResult (*pvkCreateWaylandSurfaceKHR)(VkInstance, const VkWaylandSurface static void (*pvkDestroySurfaceKHR)(VkInstance, VkSurfaceKHR, const VkAllocationCallbacks *); static VkBool32 (*pvkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice, uint32_t, struct wl_display *);
-static const struct vulkan_funcs vulkan_funcs; +static const struct vulkan_driver_funcs wayland_vulkan_driver_funcs;
struct wine_vk_surface { @@ -176,25 +176,6 @@ static void wayland_vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surfac wine_vk_surface_destroy(wine_vk_surface); }
-static VkBool32 wayland_vkGetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice phys_dev, - uint32_t index) -{ - TRACE("%p %u\n", phys_dev, index); - - return pvkGetPhysicalDeviceWaylandPresentationSupportKHR(phys_dev, index, - process_wayland.wl_display); -} - -static const char *wayland_get_host_surface_extension(void) -{ - return "VK_KHR_wayland_surface"; -} - -static VkSurfaceKHR wayland_wine_get_host_surface(VkSurfaceKHR surface) -{ - return wine_vk_surface_from_handle(surface)->host_surface; -} - static void wayland_vulkan_surface_presented(HWND hwnd, VkResult result) { struct wayland_surface *wayland_surface; @@ -216,20 +197,40 @@ static void wayland_vulkan_surface_presented(HWND hwnd, VkResult result) } }
-static const struct vulkan_funcs vulkan_funcs = +static VkBool32 wayland_vkGetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice phys_dev, + uint32_t index) +{ + TRACE("%p %u\n", phys_dev, index); + + return pvkGetPhysicalDeviceWaylandPresentationSupportKHR(phys_dev, index, + process_wayland.wl_display); +} + +static const char *wayland_get_host_surface_extension(void) +{ + return "VK_KHR_wayland_surface"; +} + +static VkSurfaceKHR wayland_wine_get_host_surface(VkSurfaceKHR surface) +{ + return wine_vk_surface_from_handle(surface)->host_surface; +} + +static const struct vulkan_driver_funcs wayland_vulkan_driver_funcs = { .p_vkCreateWin32SurfaceKHR = wayland_vkCreateWin32SurfaceKHR, .p_vkDestroySurfaceKHR = wayland_vkDestroySurfaceKHR, + .p_vulkan_surface_presented = wayland_vulkan_surface_presented, + .p_vkGetPhysicalDeviceWin32PresentationSupportKHR = wayland_vkGetPhysicalDeviceWin32PresentationSupportKHR, .p_get_host_surface_extension = wayland_get_host_surface_extension, .p_wine_get_host_surface = wayland_wine_get_host_surface, - .p_vulkan_surface_presented = wayland_vulkan_surface_presented, };
/********************************************************************** * WAYLAND_VulkanInit */ -UINT WAYLAND_VulkanInit(UINT version, void *vulkan_handle, struct vulkan_funcs *driver_funcs) +UINT WAYLAND_VulkanInit(UINT version, void *vulkan_handle, struct vulkan_driver_funcs *driver_funcs) { if (version != WINE_VULKAN_DRIVER_VERSION) { @@ -243,13 +244,13 @@ UINT WAYLAND_VulkanInit(UINT version, void *vulkan_handle, struct vulkan_funcs * LOAD_FUNCPTR(vkGetPhysicalDeviceWaylandPresentationSupportKHR); #undef LOAD_FUNCPTR
- *driver_funcs = vulkan_funcs; + *driver_funcs = wayland_vulkan_driver_funcs; return STATUS_SUCCESS; }
#else /* No vulkan */
-UINT WAYLAND_VulkanInit(UINT version, void *vulkan_handle, struct vulkan_funcs *driver_funcs) +UINT WAYLAND_VulkanInit(UINT version, void *vulkan_handle, struct vulkan_driver_funcs *driver_funcs) { ERR( "Wine was built without Vulkan support.\n" ); return STATUS_NOT_IMPLEMENTED; diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h index d6359e57db3..ee27f2cc532 100644 --- a/dlls/winewayland.drv/waylanddrv.h +++ b/dlls/winewayland.drv/waylanddrv.h @@ -338,7 +338,7 @@ void WAYLAND_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags, BOOL WAYLAND_WindowPosChanging(HWND hwnd, HWND insert_after, UINT swp_flags, const RECT *window_rect, const RECT *client_rect, RECT *visible_rect, struct window_surface **surface); -UINT WAYLAND_VulkanInit(UINT version, void *vulkan_handle, struct vulkan_funcs *driver_funcs); +UINT WAYLAND_VulkanInit(UINT version, void *vulkan_handle, struct vulkan_driver_funcs *driver_funcs); struct opengl_funcs *WAYLAND_wine_get_wgl_driver(UINT version);
#endif /* __WINE_WAYLANDDRV_H */ diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 0a0a1365b3c..8fb49130352 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -77,7 +77,7 @@ static VkResult (*pvkCreateXlibSurfaceKHR)(VkInstance, const VkXlibSurfaceCreate static void (*pvkDestroySurfaceKHR)(VkInstance, VkSurfaceKHR, const VkAllocationCallbacks *); static VkBool32 (*pvkGetPhysicalDeviceXlibPresentationSupportKHR)(VkPhysicalDevice, uint32_t, Display *, VisualID);
-static const struct vulkan_funcs vulkan_funcs; +static const struct vulkan_driver_funcs x11drv_vulkan_driver_funcs;
static inline struct wine_vk_surface *surface_from_handle(VkSurfaceKHR handle) { @@ -209,6 +209,10 @@ static void X11DRV_vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface wine_vk_surface_release(x11_surface); }
+static void X11DRV_vulkan_surface_presented(HWND hwnd, VkResult result) +{ +} + static VkBool32 X11DRV_vkGetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice phys_dev, uint32_t index) { @@ -232,25 +236,18 @@ static VkSurfaceKHR X11DRV_wine_get_host_surface( VkSurfaceKHR surface ) return x11_surface->host_surface; }
-static void X11DRV_vulkan_surface_presented(HWND hwnd, VkResult result) +static const struct vulkan_driver_funcs x11drv_vulkan_driver_funcs = { -} + .p_vkCreateWin32SurfaceKHR = X11DRV_vkCreateWin32SurfaceKHR, + .p_vkDestroySurfaceKHR = X11DRV_vkDestroySurfaceKHR, + .p_vulkan_surface_presented = X11DRV_vulkan_surface_presented,
-static const struct vulkan_funcs vulkan_funcs = -{ - X11DRV_vkCreateWin32SurfaceKHR, - X11DRV_vkDestroySurfaceKHR, - NULL, - NULL, - X11DRV_vkGetPhysicalDeviceWin32PresentationSupportKHR, - NULL, - - X11DRV_get_host_surface_extension, - X11DRV_wine_get_host_surface, - X11DRV_vulkan_surface_presented, + .p_vkGetPhysicalDeviceWin32PresentationSupportKHR = X11DRV_vkGetPhysicalDeviceWin32PresentationSupportKHR, + .p_get_host_surface_extension = X11DRV_get_host_surface_extension, + .p_wine_get_host_surface = X11DRV_wine_get_host_surface, };
-UINT X11DRV_VulkanInit( UINT version, void *vulkan_handle, struct vulkan_funcs *driver_funcs ) +UINT X11DRV_VulkanInit( UINT version, void *vulkan_handle, struct vulkan_driver_funcs *driver_funcs ) { if (version != WINE_VULKAN_DRIVER_VERSION) { @@ -266,13 +263,13 @@ UINT X11DRV_VulkanInit( UINT version, void *vulkan_handle, struct vulkan_funcs * LOAD_FUNCPTR( vkGetPhysicalDeviceXlibPresentationSupportKHR ); #undef LOAD_FUNCPTR
- *driver_funcs = vulkan_funcs; + *driver_funcs = x11drv_vulkan_driver_funcs; return STATUS_SUCCESS; }
#else /* No vulkan */
-UINT X11DRV_VulkanInit( UINT version, void *vulkan_handle, struct vulkan_funcs *driver_funcs ) +UINT X11DRV_VulkanInit( UINT version, void *vulkan_handle, struct vulkan_driver_funcs *driver_funcs ) { ERR( "Wine was built without Vulkan support.\n" ); return STATUS_NOT_IMPLEMENTED; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index af2fe18fb26..ef7a9ce98bf 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -289,7 +289,7 @@ extern BOOL shape_layered_windows; extern const struct gdi_dc_funcs *X11DRV_XRender_Init(void);
extern struct opengl_funcs *get_glx_driver(UINT); -extern UINT X11DRV_VulkanInit( UINT, void *, struct vulkan_funcs * ); +extern UINT X11DRV_VulkanInit( UINT, void *, struct vulkan_driver_funcs * );
extern struct format_entry *import_xdnd_selection( Display *display, Window win, Atom selection, Atom *targets, UINT count, diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index 7827cd3a605..11b5d6da4b2 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -269,6 +269,8 @@ struct gdi_device_manager
struct tagUPDATELAYEREDWINDOWINFO;
+struct vulkan_driver_funcs; + struct user_driver_funcs { struct gdi_dc_funcs dc_funcs; @@ -339,7 +341,7 @@ struct user_driver_funcs /* system parameters */ BOOL (*pSystemParametersInfo)(UINT,UINT,void*,UINT); /* vulkan support */ - UINT (*pVulkanInit)(UINT,void *,struct vulkan_funcs *); + UINT (*pVulkanInit)(UINT,void *,struct vulkan_driver_funcs *); /* opengl support */ struct opengl_funcs * (*pwine_get_wgl_driver)(UINT); /* thread management */ diff --git a/include/wine/vulkan_driver.h b/include/wine/vulkan_driver.h index 638b62c498c..8b24cd4978d 100644 --- a/include/wine/vulkan_driver.h +++ b/include/wine/vulkan_driver.h @@ -21,7 +21,7 @@ #define __WINE_VULKAN_DRIVER_H
/* Wine internal vulkan driver version, needs to be bumped upon vulkan_funcs changes. */ -#define WINE_VULKAN_DRIVER_VERSION 27 +#define WINE_VULKAN_DRIVER_VERSION 28
struct vulkan_funcs { @@ -39,8 +39,18 @@ struct vulkan_funcs /* winevulkan specific functions */ const char *(*p_get_host_surface_extension)(void); VkSurfaceKHR (*p_wine_get_host_surface)(VkSurfaceKHR); +};
+/* interface between win32u and the user drivers */ +struct vulkan_driver_funcs +{ + VkResult (*p_vkCreateWin32SurfaceKHR)(VkInstance, const VkWin32SurfaceCreateInfoKHR *, const VkAllocationCallbacks *, VkSurfaceKHR *); + void (*p_vkDestroySurfaceKHR)(VkInstance, VkSurfaceKHR, const VkAllocationCallbacks *); void (*p_vulkan_surface_presented)(HWND, VkResult); + + VkBool32 (*p_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice, uint32_t); + const char *(*p_get_host_surface_extension)(void); + VkSurfaceKHR (*p_wine_get_host_surface)(VkSurfaceKHR); };
#endif /* __WINE_VULKAN_DRIVER_H */
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/vulkan.c | 60 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 57 insertions(+), 3 deletions(-)
diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index 7c1d7dc50f0..06f7dfea4af 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -48,6 +48,54 @@ static VkResult (*p_vkQueuePresentKHR)(VkQueue, const VkPresentInfoKHR *); static void *(*p_vkGetDeviceProcAddr)(VkDevice, const char *); static void *(*p_vkGetInstanceProcAddr)(VkInstance, const char *);
+struct surface +{ + VkSurfaceKHR host_surface; + VkSurfaceKHR driver_surface; +}; + +static inline struct surface *surface_from_handle( VkSurfaceKHR handle ) +{ + return (struct surface *)(uintptr_t)handle; +} + +static inline VkSurfaceKHR surface_to_handle( struct surface *surface ) +{ + return (VkSurfaceKHR)(uintptr_t)surface; +} + +static VkResult win32u_vkCreateWin32SurfaceKHR( VkInstance instance, const VkWin32SurfaceCreateInfoKHR *info, + const VkAllocationCallbacks *allocator, VkSurfaceKHR *handle ) +{ + struct surface *surface; + VkResult res; + + 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 (!(surface = calloc( 1, sizeof(*surface) ))) return VK_ERROR_OUT_OF_HOST_MEMORY; + if ((res = driver_funcs.p_vkCreateWin32SurfaceKHR( instance, info, NULL /* allocator */, &surface->driver_surface ))) + { + free( surface ); + return res; + } + + surface->host_surface = driver_funcs.p_wine_get_host_surface( surface->driver_surface ); + *handle = surface_to_handle( surface ); + return VK_SUCCESS; +} + +static void win32u_vkDestroySurfaceKHR( VkInstance instance, VkSurfaceKHR handle, const VkAllocationCallbacks *allocator ) +{ + struct surface *surface = surface_from_handle( 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" ); + + driver_funcs.p_vkDestroySurfaceKHR( instance, surface->driver_surface, NULL /* allocator */ ); + free( surface ); +} + static VkResult win32u_vkQueuePresentKHR( VkQueue queue, const VkPresentInfoKHR *present_info, HWND *surfaces ) { VkPresentInfoKHR host_present_info = *present_info; @@ -95,11 +143,20 @@ static void *win32u_vkGetInstanceProcAddr( VkInstance instance, const char *name return p_vkGetInstanceProcAddr( instance, name ); }
+static VkSurfaceKHR win32u_wine_get_host_surface( VkSurfaceKHR handle ) +{ + struct surface *surface = surface_from_handle( handle ); + return surface->host_surface; +} + static struct vulkan_funcs vulkan_funcs = { + .p_vkCreateWin32SurfaceKHR = win32u_vkCreateWin32SurfaceKHR, + .p_vkDestroySurfaceKHR = win32u_vkDestroySurfaceKHR, .p_vkQueuePresentKHR = win32u_vkQueuePresentKHR, .p_vkGetDeviceProcAddr = win32u_vkGetDeviceProcAddr, .p_vkGetInstanceProcAddr = win32u_vkGetInstanceProcAddr, + .p_wine_get_host_surface = win32u_wine_get_host_surface, };
static VkResult nulldrv_vkCreateWin32SurfaceKHR( VkInstance instance, const VkWin32SurfaceCreateInfoKHR *info, @@ -165,11 +222,8 @@ static void vulkan_init(void) driver_funcs = nulldrv_funcs; else { - vulkan_funcs.p_vkCreateWin32SurfaceKHR = driver_funcs.p_vkCreateWin32SurfaceKHR; - vulkan_funcs.p_vkDestroySurfaceKHR = driver_funcs.p_vkDestroySurfaceKHR; vulkan_funcs.p_vkGetPhysicalDeviceWin32PresentationSupportKHR = driver_funcs.p_vkGetPhysicalDeviceWin32PresentationSupportKHR; vulkan_funcs.p_get_host_surface_extension = driver_funcs.p_get_host_surface_extension; - vulkan_funcs.p_wine_get_host_surface = driver_funcs.p_wine_get_host_surface; }
#define LOAD_FUNCPTR( f ) \
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/vulkan.c | 11 +++++++---- dlls/winevulkan/vulkan.c | 4 ++-- include/wine/vulkan_driver.h | 4 ++-- 3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index 06f7dfea4af..0f0b01ded85 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -52,6 +52,7 @@ struct surface { VkSurfaceKHR host_surface; VkSurfaceKHR driver_surface; + HWND hwnd; };
static inline struct surface *surface_from_handle( VkSurfaceKHR handle ) @@ -80,6 +81,7 @@ static VkResult win32u_vkCreateWin32SurfaceKHR( VkInstance instance, const VkWin return res; }
+ surface->hwnd = info->hwnd; surface->host_surface = driver_funcs.p_wine_get_host_surface( surface->driver_surface ); *handle = surface_to_handle( surface ); return VK_SUCCESS; @@ -96,20 +98,21 @@ static void win32u_vkDestroySurfaceKHR( VkInstance instance, VkSurfaceKHR handle free( surface ); }
-static VkResult win32u_vkQueuePresentKHR( VkQueue queue, const VkPresentInfoKHR *present_info, HWND *surfaces ) +static VkResult win32u_vkQueuePresentKHR( VkQueue queue, const VkPresentInfoKHR *present_info, VkSurfaceKHR *surfaces ) { - VkPresentInfoKHR host_present_info = *present_info; VkResult res; UINT i;
TRACE( "queue %p, present_info %p\n", queue, present_info );
- res = p_vkQueuePresentKHR( queue, &host_present_info ); + res = p_vkQueuePresentKHR( queue, present_info );
for (i = 0; i < present_info->swapchainCount; i++) { VkResult swapchain_res = present_info->pResults ? present_info->pResults[i] : res; - driver_funcs.p_vulkan_surface_presented( surfaces[i], swapchain_res ); + struct surface *surface = surface_from_handle( surfaces[i] ); + + driver_funcs.p_vulkan_surface_presented( surface->hwnd, swapchain_res ); }
return res; diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 4221b7066e6..d619c470e58 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -1740,7 +1740,7 @@ void wine_vkDestroySwapchainKHR(VkDevice device_handle, VkSwapchainKHR swapchain VkResult wine_vkQueuePresentKHR(VkQueue queue_handle, const VkPresentInfoKHR *present_info) { VkSwapchainKHR swapchains_buffer[16], *swapchains = swapchains_buffer; - HWND surfaces_buffer[ARRAY_SIZE(swapchains_buffer)], *surfaces = surfaces_buffer; + VkSurfaceKHR surfaces_buffer[ARRAY_SIZE(swapchains_buffer)], *surfaces = surfaces_buffer; struct wine_queue *queue = wine_queue_from_handle(queue_handle); VkPresentInfoKHR present_info_host = *present_info; VkResult res; @@ -1759,7 +1759,7 @@ VkResult wine_vkQueuePresentKHR(VkQueue queue_handle, const VkPresentInfoKHR *pr struct wine_swapchain *swapchain = wine_swapchain_from_handle(present_info->pSwapchains[i]); struct wine_surface *surface = swapchain->surface; swapchains[i] = swapchain->host_swapchain; - surfaces[i] = surface->hwnd; + surfaces[i] = surface->driver_surface; }
present_info_host.pSwapchains = swapchains; diff --git a/include/wine/vulkan_driver.h b/include/wine/vulkan_driver.h index 8b24cd4978d..96f60cb067a 100644 --- a/include/wine/vulkan_driver.h +++ b/include/wine/vulkan_driver.h @@ -21,7 +21,7 @@ #define __WINE_VULKAN_DRIVER_H
/* Wine internal vulkan driver version, needs to be bumped upon vulkan_funcs changes. */ -#define WINE_VULKAN_DRIVER_VERSION 28 +#define WINE_VULKAN_DRIVER_VERSION 29
struct vulkan_funcs { @@ -34,7 +34,7 @@ struct vulkan_funcs void * (*p_vkGetDeviceProcAddr)(VkDevice, const char *); void * (*p_vkGetInstanceProcAddr)(VkInstance, const char *); VkBool32 (*p_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice, uint32_t); - VkResult (*p_vkQueuePresentKHR)(VkQueue, const VkPresentInfoKHR *, HWND *surfaces); + VkResult (*p_vkQueuePresentKHR)(VkQueue, const VkPresentInfoKHR *, VkSurfaceKHR *surfaces);
/* winevulkan specific functions */ const char *(*p_get_host_surface_extension)(void);
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/vulkan.c | 13 ++++++------- dlls/winemac.drv/vulkan.c | 22 +++++++--------------- dlls/winewayland.drv/vulkan.c | 24 ++++++++---------------- dlls/winex11.drv/vulkan.c | 21 ++++++--------------- include/wine/vulkan_driver.h | 6 +++--- 5 files changed, 30 insertions(+), 56 deletions(-)
diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index 0f0b01ded85..49a98acb88a 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -75,7 +75,7 @@ static VkResult win32u_vkCreateWin32SurfaceKHR( VkInstance instance, const VkWin if (allocator) FIXME( "Support for allocation callbacks not implemented yet\n" );
if (!(surface = calloc( 1, sizeof(*surface) ))) return VK_ERROR_OUT_OF_HOST_MEMORY; - if ((res = driver_funcs.p_vkCreateWin32SurfaceKHR( instance, info, NULL /* allocator */, &surface->driver_surface ))) + if ((res = driver_funcs.p_vulkan_surface_create( instance, info, &surface->driver_surface ))) { free( surface ); return res; @@ -94,7 +94,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" );
- driver_funcs.p_vkDestroySurfaceKHR( instance, surface->driver_surface, NULL /* allocator */ ); + driver_funcs.p_vulkan_surface_destroy( instance, surface->driver_surface ); free( surface ); }
@@ -162,14 +162,13 @@ static struct vulkan_funcs vulkan_funcs = .p_wine_get_host_surface = win32u_wine_get_host_surface, };
-static VkResult nulldrv_vkCreateWin32SurfaceKHR( VkInstance instance, const VkWin32SurfaceCreateInfoKHR *info, - const VkAllocationCallbacks *allocator, VkSurfaceKHR *surface ) +static VkResult nulldrv_vulkan_surface_create( VkInstance instance, const VkWin32SurfaceCreateInfoKHR *info, VkSurfaceKHR *surface ) { FIXME( "stub!\n" ); return VK_ERROR_INCOMPATIBLE_DRIVER; }
-static void nulldrv_vkDestroySurfaceKHR( VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks *allocator ) +static void nulldrv_vulkan_surface_destroy( VkInstance instance, VkSurfaceKHR surface ) { }
@@ -194,8 +193,8 @@ static VkSurfaceKHR nulldrv_wine_get_host_surface( VkSurfaceKHR surface )
static const struct vulkan_driver_funcs nulldrv_funcs = { - .p_vkCreateWin32SurfaceKHR = nulldrv_vkCreateWin32SurfaceKHR, - .p_vkDestroySurfaceKHR = nulldrv_vkDestroySurfaceKHR, + .p_vulkan_surface_create = nulldrv_vulkan_surface_create, + .p_vulkan_surface_destroy = nulldrv_vulkan_surface_destroy, .p_vulkan_surface_presented = nulldrv_vulkan_surface_presented, .p_vkGetPhysicalDeviceWin32PresentationSupportKHR = nulldrv_vkGetPhysicalDeviceWin32PresentationSupportKHR, .p_get_host_surface_extension = nulldrv_get_host_surface_extension, diff --git a/dlls/winemac.drv/vulkan.c b/dlls/winemac.drv/vulkan.c index 3f7b12ca4ac..eea3ef21ecc 100644 --- a/dlls/winemac.drv/vulkan.c +++ b/dlls/winemac.drv/vulkan.c @@ -100,18 +100,14 @@ static void wine_vk_surface_destroy(VkInstance instance, struct wine_vk_surface free(surface); }
-static VkResult macdrv_vkCreateWin32SurfaceKHR(VkInstance instance, - const VkWin32SurfaceCreateInfoKHR *create_info, - const VkAllocationCallbacks *allocator, VkSurfaceKHR *surface) +static VkResult macdrv_vulkan_surface_create(VkInstance instance, + const VkWin32SurfaceCreateInfoKHR *create_info, VkSurfaceKHR *surface) { VkResult res; struct wine_vk_surface *mac_surface; struct macdrv_win_data *data;
- TRACE("%p %p %p %p\n", instance, create_info, allocator, surface); - - if (allocator) - FIXME("Support for allocation callbacks not implemented yet\n"); + TRACE("%p %p %p\n", instance, create_info, surface);
if (!(data = get_win_data(create_info->hwnd))) { @@ -183,15 +179,11 @@ err: return res; }
-static void macdrv_vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, - const VkAllocationCallbacks *allocator) +static void macdrv_vulkan_surface_destroy(VkInstance instance, VkSurfaceKHR surface) { struct wine_vk_surface *mac_surface = surface_from_handle(surface);
- TRACE("%p 0x%s %p\n", instance, wine_dbgstr_longlong(surface), allocator); - - if (allocator) - FIXME("Support for allocation callbacks not implemented yet\n"); + TRACE("%p 0x%s\n", instance, wine_dbgstr_longlong(surface));
wine_vk_surface_destroy(instance, mac_surface); } @@ -224,8 +216,8 @@ static VkSurfaceKHR macdrv_wine_get_host_surface(VkSurfaceKHR surface)
static const struct vulkan_driver_funcs macdrv_vulkan_driver_funcs = { - .p_vkCreateWin32SurfaceKHR = macdrv_vkCreateWin32SurfaceKHR, - .p_vkDestroySurfaceKHR = macdrv_vkDestroySurfaceKHR, + .p_vulkan_surface_create = macdrv_vulkan_surface_create, + .p_vulkan_surface_destroy = macdrv_vulkan_surface_destroy, .p_vulkan_surface_presented = macdrv_vulkan_surface_presented,
.p_vkGetPhysicalDeviceWin32PresentationSupportKHR = macdrv_vkGetPhysicalDeviceWin32PresentationSupportKHR, diff --git a/dlls/winewayland.drv/vulkan.c b/dlls/winewayland.drv/vulkan.c index bed974b4525..63113f6b3b3 100644 --- a/dlls/winewayland.drv/vulkan.c +++ b/dlls/winewayland.drv/vulkan.c @@ -94,20 +94,16 @@ static void wine_vk_surface_destroy(struct wine_vk_surface *wine_vk_surface) free(wine_vk_surface); }
-static VkResult wayland_vkCreateWin32SurfaceKHR(VkInstance instance, - const VkWin32SurfaceCreateInfoKHR *create_info, - const VkAllocationCallbacks *allocator, - VkSurfaceKHR *vk_surface) +static VkResult wayland_vulkan_surface_create(VkInstance instance, + const VkWin32SurfaceCreateInfoKHR *create_info, + VkSurfaceKHR *vk_surface) { VkResult res; VkWaylandSurfaceCreateInfoKHR create_info_host; struct wine_vk_surface *wine_vk_surface; struct wayland_surface *wayland_surface;
- TRACE("%p %p %p %p\n", instance, create_info, allocator, vk_surface); - - if (allocator) - FIXME("Support for allocation callbacks not implemented yet\n"); + TRACE("%p %p %p\n", instance, create_info, vk_surface);
wine_vk_surface = calloc(1, sizeof(*wine_vk_surface)); if (!wine_vk_surface) @@ -162,15 +158,11 @@ err: return res; }
-static void wayland_vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, - const VkAllocationCallbacks *allocator) +static void wayland_vulkan_surface_destroy(VkInstance instance, VkSurfaceKHR surface) { struct wine_vk_surface *wine_vk_surface = wine_vk_surface_from_handle(surface);
- TRACE("%p 0x%s %p\n", instance, wine_dbgstr_longlong(surface), allocator); - - if (allocator) - FIXME("Support for allocation callbacks not implemented yet\n"); + TRACE("%p 0x%s\n", instance, wine_dbgstr_longlong(surface));
pvkDestroySurfaceKHR(instance, wine_vk_surface->host_surface, NULL /* allocator */); wine_vk_surface_destroy(wine_vk_surface); @@ -218,8 +210,8 @@ static VkSurfaceKHR wayland_wine_get_host_surface(VkSurfaceKHR surface)
static const struct vulkan_driver_funcs wayland_vulkan_driver_funcs = { - .p_vkCreateWin32SurfaceKHR = wayland_vkCreateWin32SurfaceKHR, - .p_vkDestroySurfaceKHR = wayland_vkDestroySurfaceKHR, + .p_vulkan_surface_create = wayland_vulkan_surface_create, + .p_vulkan_surface_destroy = wayland_vulkan_surface_destroy, .p_vulkan_surface_presented = wayland_vulkan_surface_presented,
.p_vkGetPhysicalDeviceWin32PresentationSupportKHR = wayland_vkGetPhysicalDeviceWin32PresentationSupportKHR, diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 8fb49130352..e8ffc15aea0 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -132,18 +132,13 @@ void vulkan_thread_detach(void) pthread_mutex_unlock(&vulkan_mutex); }
-static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance, - const VkWin32SurfaceCreateInfoKHR *create_info, - const VkAllocationCallbacks *allocator, VkSurfaceKHR *surface) +static VkResult X11DRV_vulkan_surface_create( VkInstance instance, const VkWin32SurfaceCreateInfoKHR *create_info, VkSurfaceKHR *surface ) { VkResult res; VkXlibSurfaceCreateInfoKHR create_info_host; struct wine_vk_surface *x11_surface;
- TRACE("%p %p %p %p\n", instance, create_info, allocator, surface); - - if (allocator) - FIXME("Support for allocation callbacks not implemented yet\n"); + TRACE( "%p %p %p\n", instance, create_info, surface );
/* TODO: support child window rendering. */ if (NtUserGetAncestor( create_info->hwnd, GA_PARENT ) != NtUserGetDesktopWindow()) @@ -195,15 +190,11 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance, return VK_SUCCESS; }
-static void X11DRV_vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, - const VkAllocationCallbacks *allocator) +static void X11DRV_vulkan_surface_destroy( VkInstance instance, VkSurfaceKHR surface ) { struct wine_vk_surface *x11_surface = surface_from_handle(surface);
- TRACE("%p 0x%s %p\n", instance, wine_dbgstr_longlong(surface), allocator); - - if (allocator) - FIXME("Support for allocation callbacks not implemented yet\n"); + TRACE( "%p 0x%s\n", instance, wine_dbgstr_longlong(surface) );
pvkDestroySurfaceKHR( instance, x11_surface->host_surface, NULL /* allocator */ ); wine_vk_surface_release(x11_surface); @@ -238,8 +229,8 @@ static VkSurfaceKHR X11DRV_wine_get_host_surface( VkSurfaceKHR surface )
static const struct vulkan_driver_funcs x11drv_vulkan_driver_funcs = { - .p_vkCreateWin32SurfaceKHR = X11DRV_vkCreateWin32SurfaceKHR, - .p_vkDestroySurfaceKHR = X11DRV_vkDestroySurfaceKHR, + .p_vulkan_surface_create = X11DRV_vulkan_surface_create, + .p_vulkan_surface_destroy = X11DRV_vulkan_surface_destroy, .p_vulkan_surface_presented = X11DRV_vulkan_surface_presented,
.p_vkGetPhysicalDeviceWin32PresentationSupportKHR = X11DRV_vkGetPhysicalDeviceWin32PresentationSupportKHR, diff --git a/include/wine/vulkan_driver.h b/include/wine/vulkan_driver.h index 96f60cb067a..241650e2496 100644 --- a/include/wine/vulkan_driver.h +++ b/include/wine/vulkan_driver.h @@ -21,7 +21,7 @@ #define __WINE_VULKAN_DRIVER_H
/* Wine internal vulkan driver version, needs to be bumped upon vulkan_funcs changes. */ -#define WINE_VULKAN_DRIVER_VERSION 29 +#define WINE_VULKAN_DRIVER_VERSION 30
struct vulkan_funcs { @@ -44,8 +44,8 @@ struct vulkan_funcs /* interface between win32u and the user drivers */ struct vulkan_driver_funcs { - VkResult (*p_vkCreateWin32SurfaceKHR)(VkInstance, const VkWin32SurfaceCreateInfoKHR *, const VkAllocationCallbacks *, VkSurfaceKHR *); - void (*p_vkDestroySurfaceKHR)(VkInstance, VkSurfaceKHR, const VkAllocationCallbacks *); + VkResult (*p_vulkan_surface_create)(VkInstance, const VkWin32SurfaceCreateInfoKHR *, VkSurfaceKHR *); + void (*p_vulkan_surface_destroy)(VkInstance, VkSurfaceKHR); void (*p_vulkan_surface_presented)(HWND, VkResult);
VkBool32 (*p_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice, uint32_t);
From: Rémi Bernon rbernon@codeweavers.com
And to destroy, it'll be useful later. --- dlls/win32u/vulkan.c | 8 ++++---- dlls/winemac.drv/vulkan.c | 17 ++++++++--------- dlls/winewayland.drv/vulkan.c | 16 +++++++--------- dlls/winex11.drv/vulkan.c | 16 ++++++++-------- include/wine/vulkan_driver.h | 6 +++--- 5 files changed, 30 insertions(+), 33 deletions(-)
diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index 49a98acb88a..12ba548af60 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -75,7 +75,7 @@ static VkResult win32u_vkCreateWin32SurfaceKHR( VkInstance instance, const VkWin if (allocator) FIXME( "Support for allocation callbacks not implemented yet\n" );
if (!(surface = calloc( 1, sizeof(*surface) ))) return VK_ERROR_OUT_OF_HOST_MEMORY; - if ((res = driver_funcs.p_vulkan_surface_create( instance, info, &surface->driver_surface ))) + if ((res = driver_funcs.p_vulkan_surface_create( info->hwnd, instance, &surface->driver_surface ))) { free( surface ); return res; @@ -94,7 +94,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" );
- driver_funcs.p_vulkan_surface_destroy( instance, surface->driver_surface ); + driver_funcs.p_vulkan_surface_destroy( surface->hwnd, instance, surface->driver_surface ); free( surface ); }
@@ -162,13 +162,13 @@ static struct vulkan_funcs vulkan_funcs = .p_wine_get_host_surface = win32u_wine_get_host_surface, };
-static VkResult nulldrv_vulkan_surface_create( VkInstance instance, const VkWin32SurfaceCreateInfoKHR *info, VkSurfaceKHR *surface ) +static VkResult nulldrv_vulkan_surface_create( HWND hwnd, VkInstance instance, VkSurfaceKHR *surface ) { FIXME( "stub!\n" ); return VK_ERROR_INCOMPATIBLE_DRIVER; }
-static void nulldrv_vulkan_surface_destroy( VkInstance instance, VkSurfaceKHR surface ) +static void nulldrv_vulkan_surface_destroy( HWND hwnd, VkInstance instance, VkSurfaceKHR surface ) { }
diff --git a/dlls/winemac.drv/vulkan.c b/dlls/winemac.drv/vulkan.c index eea3ef21ecc..99ee43a2c7a 100644 --- a/dlls/winemac.drv/vulkan.c +++ b/dlls/winemac.drv/vulkan.c @@ -100,18 +100,17 @@ static void wine_vk_surface_destroy(VkInstance instance, struct wine_vk_surface free(surface); }
-static VkResult macdrv_vulkan_surface_create(VkInstance instance, - const VkWin32SurfaceCreateInfoKHR *create_info, VkSurfaceKHR *surface) +static VkResult macdrv_vulkan_surface_create(HWND hwnd, VkInstance instance, VkSurfaceKHR *surface) { VkResult res; struct wine_vk_surface *mac_surface; struct macdrv_win_data *data;
- TRACE("%p %p %p\n", instance, create_info, surface); + TRACE("%p %p %p\n", hwnd, instance, surface);
- if (!(data = get_win_data(create_info->hwnd))) + if (!(data = get_win_data(hwnd))) { - FIXME("DC for window %p of other process: not implemented\n", create_info->hwnd); + FIXME("DC for window %p of other process: not implemented\n", hwnd); return VK_ERROR_INCOMPATIBLE_DRIVER; }
@@ -125,7 +124,7 @@ static VkResult macdrv_vulkan_surface_create(VkInstance instance, mac_surface->device = macdrv_create_metal_device(); if (!mac_surface->device) { - ERR("Failed to allocate Metal device for hwnd=%p\n", create_info->hwnd); + ERR("Failed to allocate Metal device for hwnd=%p\n", hwnd); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto err; } @@ -133,7 +132,7 @@ static VkResult macdrv_vulkan_surface_create(VkInstance instance, mac_surface->view = macdrv_view_create_metal_view(data->client_cocoa_view, mac_surface->device); if (!mac_surface->view) { - ERR("Failed to allocate Metal view for hwnd=%p\n", create_info->hwnd); + ERR("Failed to allocate Metal view for hwnd=%p\n", hwnd);
/* VK_KHR_win32_surface only allows out of host and device memory as errors. */ res = VK_ERROR_OUT_OF_HOST_MEMORY; @@ -179,11 +178,11 @@ err: return res; }
-static void macdrv_vulkan_surface_destroy(VkInstance instance, VkSurfaceKHR surface) +static void macdrv_vulkan_surface_destroy(HWND hwnd, VkInstance instance, VkSurfaceKHR surface) { struct wine_vk_surface *mac_surface = surface_from_handle(surface);
- TRACE("%p 0x%s\n", instance, wine_dbgstr_longlong(surface)); + TRACE("%p %p 0x%s\n", hwnd, instance, wine_dbgstr_longlong(surface));
wine_vk_surface_destroy(instance, mac_surface); } diff --git a/dlls/winewayland.drv/vulkan.c b/dlls/winewayland.drv/vulkan.c index 63113f6b3b3..29033b46f0b 100644 --- a/dlls/winewayland.drv/vulkan.c +++ b/dlls/winewayland.drv/vulkan.c @@ -94,16 +94,14 @@ static void wine_vk_surface_destroy(struct wine_vk_surface *wine_vk_surface) free(wine_vk_surface); }
-static VkResult wayland_vulkan_surface_create(VkInstance instance, - const VkWin32SurfaceCreateInfoKHR *create_info, - VkSurfaceKHR *vk_surface) +static VkResult wayland_vulkan_surface_create(HWND hwnd, VkInstance instance, VkSurfaceKHR *vk_surface) { VkResult res; VkWaylandSurfaceCreateInfoKHR create_info_host; struct wine_vk_surface *wine_vk_surface; struct wayland_surface *wayland_surface;
- TRACE("%p %p %p\n", instance, create_info, vk_surface); + TRACE("%p %p %p\n", hwnd, instance, vk_surface);
wine_vk_surface = calloc(1, sizeof(*wine_vk_surface)); if (!wine_vk_surface) @@ -113,10 +111,10 @@ static VkResult wayland_vulkan_surface_create(VkInstance instance, goto err; }
- wayland_surface = wayland_surface_lock_hwnd(create_info->hwnd); + wayland_surface = wayland_surface_lock_hwnd(hwnd); if (!wayland_surface) { - ERR("Failed to find wayland surface for hwnd=%p\n", create_info->hwnd); + ERR("Failed to find wayland surface for hwnd=%p\n", hwnd); /* VK_KHR_win32_surface only allows out of host and device memory as errors. */ res = VK_ERROR_OUT_OF_HOST_MEMORY; goto err; @@ -127,7 +125,7 @@ static VkResult wayland_vulkan_surface_create(VkInstance instance,
if (!wine_vk_surface->client) { - ERR("Failed to create client surface for hwnd=%p\n", create_info->hwnd); + ERR("Failed to create client surface for hwnd=%p\n", hwnd); /* VK_KHR_win32_surface only allows out of host and device memory as errors. */ res = VK_ERROR_OUT_OF_HOST_MEMORY; goto err; @@ -158,11 +156,11 @@ err: return res; }
-static void wayland_vulkan_surface_destroy(VkInstance instance, VkSurfaceKHR surface) +static void wayland_vulkan_surface_destroy(HWND hwnd, VkInstance instance, VkSurfaceKHR surface) { struct wine_vk_surface *wine_vk_surface = wine_vk_surface_from_handle(surface);
- TRACE("%p 0x%s\n", instance, wine_dbgstr_longlong(surface)); + TRACE("%p %p 0x%s\n", hwnd, instance, wine_dbgstr_longlong(surface));
pvkDestroySurfaceKHR(instance, wine_vk_surface->host_surface, NULL /* allocator */); wine_vk_surface_destroy(wine_vk_surface); diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index e8ffc15aea0..dc946d95276 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -132,16 +132,16 @@ void vulkan_thread_detach(void) pthread_mutex_unlock(&vulkan_mutex); }
-static VkResult X11DRV_vulkan_surface_create( VkInstance instance, const VkWin32SurfaceCreateInfoKHR *create_info, VkSurfaceKHR *surface ) +static VkResult X11DRV_vulkan_surface_create( HWND hwnd, VkInstance instance, VkSurfaceKHR *surface ) { VkResult res; VkXlibSurfaceCreateInfoKHR create_info_host; struct wine_vk_surface *x11_surface;
- TRACE( "%p %p %p\n", instance, create_info, surface ); + TRACE( "%p %p %p\n", hwnd, instance, surface );
/* TODO: support child window rendering. */ - if (NtUserGetAncestor( create_info->hwnd, GA_PARENT ) != NtUserGetDesktopWindow()) + if (NtUserGetAncestor( hwnd, GA_PARENT ) != NtUserGetDesktopWindow()) { FIXME("Application requires child window rendering, which is not implemented yet!\n"); return VK_ERROR_INCOMPATIBLE_DRIVER; @@ -152,13 +152,13 @@ static VkResult X11DRV_vulkan_surface_create( VkInstance instance, const VkWin32 return VK_ERROR_OUT_OF_HOST_MEMORY;
x11_surface->ref = 1; - x11_surface->hwnd = create_info->hwnd; - x11_surface->window = create_client_window( create_info->hwnd, &default_visual, default_colormap ); + x11_surface->hwnd = hwnd; + x11_surface->window = create_client_window( hwnd, &default_visual, default_colormap ); x11_surface->hwnd_thread_id = NtUserGetWindowThread( x11_surface->hwnd, NULL );
if (!x11_surface->window) { - ERR("Failed to allocate client window for hwnd=%p\n", create_info->hwnd); + ERR( "Failed to allocate client window for hwnd=%p\n", hwnd );
/* VK_KHR_win32_surface only allows out of host and device memory as errors. */ free(x11_surface); @@ -190,11 +190,11 @@ static VkResult X11DRV_vulkan_surface_create( VkInstance instance, const VkWin32 return VK_SUCCESS; }
-static void X11DRV_vulkan_surface_destroy( VkInstance instance, VkSurfaceKHR surface ) +static void X11DRV_vulkan_surface_destroy( HWND hwnd, VkInstance instance, VkSurfaceKHR surface ) { struct wine_vk_surface *x11_surface = surface_from_handle(surface);
- TRACE( "%p 0x%s\n", instance, wine_dbgstr_longlong(surface) ); + TRACE( "%p %p 0x%s\n", hwnd, instance, wine_dbgstr_longlong(surface) );
pvkDestroySurfaceKHR( instance, x11_surface->host_surface, NULL /* allocator */ ); wine_vk_surface_release(x11_surface); diff --git a/include/wine/vulkan_driver.h b/include/wine/vulkan_driver.h index 241650e2496..32cd2a771d5 100644 --- a/include/wine/vulkan_driver.h +++ b/include/wine/vulkan_driver.h @@ -21,7 +21,7 @@ #define __WINE_VULKAN_DRIVER_H
/* Wine internal vulkan driver version, needs to be bumped upon vulkan_funcs changes. */ -#define WINE_VULKAN_DRIVER_VERSION 30 +#define WINE_VULKAN_DRIVER_VERSION 31
struct vulkan_funcs { @@ -44,8 +44,8 @@ struct vulkan_funcs /* interface between win32u and the user drivers */ struct vulkan_driver_funcs { - VkResult (*p_vulkan_surface_create)(VkInstance, const VkWin32SurfaceCreateInfoKHR *, VkSurfaceKHR *); - void (*p_vulkan_surface_destroy)(VkInstance, VkSurfaceKHR); + VkResult (*p_vulkan_surface_create)(HWND, VkInstance, VkSurfaceKHR *); + void (*p_vulkan_surface_destroy)(HWND, VkInstance, VkSurfaceKHR); void (*p_vulkan_surface_presented)(HWND, VkResult);
VkBool32 (*p_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice, uint32_t);
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/vulkan.c | 9 ++++++--- dlls/winemac.drv/vulkan.c | 14 +++++--------- dlls/winewayland.drv/vulkan.c | 7 ++----- dlls/winex11.drv/vulkan.c | 7 ++----- include/wine/vulkan_driver.h | 4 ++-- 5 files changed, 17 insertions(+), 24 deletions(-)
diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index 12ba548af60..37bb04eecd7 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -44,6 +44,7 @@ static void *vulkan_handle; static struct vulkan_driver_funcs driver_funcs; static struct vulkan_funcs vulkan_funcs;
+static void (*p_vkDestroySurfaceKHR)(VkInstance, VkSurfaceKHR, const VkAllocationCallbacks *); static VkResult (*p_vkQueuePresentKHR)(VkQueue, const VkPresentInfoKHR *); static void *(*p_vkGetDeviceProcAddr)(VkDevice, const char *); static void *(*p_vkGetInstanceProcAddr)(VkInstance, const char *); @@ -94,7 +95,8 @@ 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" );
- driver_funcs.p_vulkan_surface_destroy( surface->hwnd, instance, surface->driver_surface ); + p_vkDestroySurfaceKHR( instance, surface->host_surface, NULL /* allocator */ ); + driver_funcs.p_vulkan_surface_destroy( surface->hwnd, surface->driver_surface ); free( surface ); }
@@ -168,7 +170,7 @@ static VkResult nulldrv_vulkan_surface_create( HWND hwnd, VkInstance instance, V return VK_ERROR_INCOMPATIBLE_DRIVER; }
-static void nulldrv_vulkan_surface_destroy( HWND hwnd, VkInstance instance, VkSurfaceKHR surface ) +static void nulldrv_vulkan_surface_destroy( HWND hwnd, VkSurfaceKHR surface ) { }
@@ -237,9 +239,10 @@ static void vulkan_init(void) return; \ }
+ LOAD_FUNCPTR( vkDestroySurfaceKHR ); + LOAD_FUNCPTR( vkQueuePresentKHR ); LOAD_FUNCPTR( vkGetDeviceProcAddr ); LOAD_FUNCPTR( vkGetInstanceProcAddr ); - LOAD_FUNCPTR( vkQueuePresentKHR ); #undef LOAD_FUNCPTR }
diff --git a/dlls/winemac.drv/vulkan.c b/dlls/winemac.drv/vulkan.c index 99ee43a2c7a..c4747196f04 100644 --- a/dlls/winemac.drv/vulkan.c +++ b/dlls/winemac.drv/vulkan.c @@ -77,7 +77,6 @@ typedef struct VkMetalSurfaceCreateInfoEXT
static VkResult (*pvkCreateMacOSSurfaceMVK)(VkInstance, const VkMacOSSurfaceCreateInfoMVK*, const VkAllocationCallbacks *, VkSurfaceKHR *); static VkResult (*pvkCreateMetalSurfaceEXT)(VkInstance, const VkMetalSurfaceCreateInfoEXT*, const VkAllocationCallbacks *, VkSurfaceKHR *); -static void (*pvkDestroySurfaceKHR)(VkInstance, VkSurfaceKHR, const VkAllocationCallbacks *); static VkResult (*pvkGetPhysicalDeviceSurfaceCapabilities2KHR)(VkPhysicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *, VkSurfaceCapabilities2KHR *);
static const struct vulkan_driver_funcs macdrv_vulkan_driver_funcs; @@ -87,10 +86,8 @@ static inline struct wine_vk_surface *surface_from_handle(VkSurfaceKHR handle) return (struct wine_vk_surface *)(uintptr_t)handle; }
-static void wine_vk_surface_destroy(VkInstance instance, struct wine_vk_surface *surface) +static void wine_vk_surface_destroy(struct wine_vk_surface *surface) { - pvkDestroySurfaceKHR(instance, surface->host_surface, NULL /* allocator */); - if (surface->view) macdrv_view_release_metal_view(surface->view);
@@ -173,18 +170,18 @@ static VkResult macdrv_vulkan_surface_create(HWND hwnd, VkInstance instance, VkS return VK_SUCCESS;
err: - wine_vk_surface_destroy(instance, mac_surface); + wine_vk_surface_destroy(mac_surface); release_win_data(data); return res; }
-static void macdrv_vulkan_surface_destroy(HWND hwnd, VkInstance instance, VkSurfaceKHR surface) +static void macdrv_vulkan_surface_destroy(HWND hwnd, VkSurfaceKHR surface) { struct wine_vk_surface *mac_surface = surface_from_handle(surface);
- TRACE("%p %p 0x%s\n", hwnd, instance, wine_dbgstr_longlong(surface)); + TRACE("%p 0x%s\n", hwnd, wine_dbgstr_longlong(surface));
- wine_vk_surface_destroy(instance, mac_surface); + wine_vk_surface_destroy(mac_surface); }
static void macdrv_vulkan_surface_presented(HWND hwnd, VkResult result) @@ -235,7 +232,6 @@ UINT macdrv_VulkanInit(UINT version, void *vulkan_handle, struct vulkan_driver_f #define LOAD_FUNCPTR(f) if ((p##f = dlsym(vulkan_handle, #f)) == NULL) return STATUS_PROCEDURE_NOT_FOUND; LOAD_FUNCPTR(vkCreateMacOSSurfaceMVK) LOAD_FUNCPTR(vkCreateMetalSurfaceEXT) - LOAD_FUNCPTR(vkDestroySurfaceKHR) #undef LOAD_FUNCPTR
*driver_funcs = macdrv_vulkan_driver_funcs; diff --git a/dlls/winewayland.drv/vulkan.c b/dlls/winewayland.drv/vulkan.c index 29033b46f0b..ce7b0fc3e92 100644 --- a/dlls/winewayland.drv/vulkan.c +++ b/dlls/winewayland.drv/vulkan.c @@ -54,7 +54,6 @@ typedef struct VkWaylandSurfaceCreateInfoKHR } VkWaylandSurfaceCreateInfoKHR;
static VkResult (*pvkCreateWaylandSurfaceKHR)(VkInstance, const VkWaylandSurfaceCreateInfoKHR *, const VkAllocationCallbacks *, VkSurfaceKHR *); -static void (*pvkDestroySurfaceKHR)(VkInstance, VkSurfaceKHR, const VkAllocationCallbacks *); static VkBool32 (*pvkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice, uint32_t, struct wl_display *);
static const struct vulkan_driver_funcs wayland_vulkan_driver_funcs; @@ -156,13 +155,12 @@ err: return res; }
-static void wayland_vulkan_surface_destroy(HWND hwnd, VkInstance instance, VkSurfaceKHR surface) +static void wayland_vulkan_surface_destroy(HWND hwnd, VkSurfaceKHR surface) { struct wine_vk_surface *wine_vk_surface = wine_vk_surface_from_handle(surface);
- TRACE("%p %p 0x%s\n", hwnd, instance, wine_dbgstr_longlong(surface)); + TRACE("%p 0x%s\n", hwnd, wine_dbgstr_longlong(surface));
- pvkDestroySurfaceKHR(instance, wine_vk_surface->host_surface, NULL /* allocator */); wine_vk_surface_destroy(wine_vk_surface); }
@@ -230,7 +228,6 @@ UINT WAYLAND_VulkanInit(UINT version, void *vulkan_handle, struct vulkan_driver_
#define LOAD_FUNCPTR(f) if (!(p##f = dlsym(vulkan_handle, #f))) return STATUS_PROCEDURE_NOT_FOUND; LOAD_FUNCPTR(vkCreateWaylandSurfaceKHR); - LOAD_FUNCPTR(vkDestroySurfaceKHR); LOAD_FUNCPTR(vkGetPhysicalDeviceWaylandPresentationSupportKHR); #undef LOAD_FUNCPTR
diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index dc946d95276..67f3e881d31 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -74,7 +74,6 @@ typedef struct VkXlibSurfaceCreateInfoKHR } VkXlibSurfaceCreateInfoKHR;
static VkResult (*pvkCreateXlibSurfaceKHR)(VkInstance, const VkXlibSurfaceCreateInfoKHR *, const VkAllocationCallbacks *, VkSurfaceKHR *); -static void (*pvkDestroySurfaceKHR)(VkInstance, VkSurfaceKHR, const VkAllocationCallbacks *); static VkBool32 (*pvkGetPhysicalDeviceXlibPresentationSupportKHR)(VkPhysicalDevice, uint32_t, Display *, VisualID);
static const struct vulkan_driver_funcs x11drv_vulkan_driver_funcs; @@ -190,13 +189,12 @@ static VkResult X11DRV_vulkan_surface_create( HWND hwnd, VkInstance instance, Vk return VK_SUCCESS; }
-static void X11DRV_vulkan_surface_destroy( HWND hwnd, VkInstance instance, VkSurfaceKHR surface ) +static void X11DRV_vulkan_surface_destroy( HWND hwnd, VkSurfaceKHR surface ) { struct wine_vk_surface *x11_surface = surface_from_handle(surface);
- TRACE( "%p %p 0x%s\n", hwnd, instance, wine_dbgstr_longlong(surface) ); + TRACE( "%p 0x%s\n", hwnd, wine_dbgstr_longlong(surface) );
- pvkDestroySurfaceKHR( instance, x11_surface->host_surface, NULL /* allocator */ ); wine_vk_surface_release(x11_surface); }
@@ -250,7 +248,6 @@ UINT X11DRV_VulkanInit( UINT version, void *vulkan_handle, struct vulkan_driver_
#define LOAD_FUNCPTR( f ) if (!(p##f = dlsym( vulkan_handle, #f ))) return STATUS_PROCEDURE_NOT_FOUND; LOAD_FUNCPTR( vkCreateXlibSurfaceKHR ); - LOAD_FUNCPTR( vkDestroySurfaceKHR ); LOAD_FUNCPTR( vkGetPhysicalDeviceXlibPresentationSupportKHR ); #undef LOAD_FUNCPTR
diff --git a/include/wine/vulkan_driver.h b/include/wine/vulkan_driver.h index 32cd2a771d5..20931374ce2 100644 --- a/include/wine/vulkan_driver.h +++ b/include/wine/vulkan_driver.h @@ -21,7 +21,7 @@ #define __WINE_VULKAN_DRIVER_H
/* Wine internal vulkan driver version, needs to be bumped upon vulkan_funcs changes. */ -#define WINE_VULKAN_DRIVER_VERSION 31 +#define WINE_VULKAN_DRIVER_VERSION 32
struct vulkan_funcs { @@ -45,7 +45,7 @@ struct vulkan_funcs struct vulkan_driver_funcs { VkResult (*p_vulkan_surface_create)(HWND, VkInstance, VkSurfaceKHR *); - void (*p_vulkan_surface_destroy)(HWND, VkInstance, VkSurfaceKHR); + void (*p_vulkan_surface_destroy)(HWND, VkSurfaceKHR); void (*p_vulkan_surface_presented)(HWND, VkResult);
VkBool32 (*p_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice, uint32_t);
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/vulkan.c | 17 +++++------------ dlls/winemac.drv/vulkan.c | 36 ++++++++++------------------------- dlls/winewayland.drv/vulkan.c | 33 ++++++++++---------------------- dlls/winex11.drv/vulkan.c | 34 +++++++++------------------------ include/wine/vulkan_driver.h | 7 +++---- 5 files changed, 37 insertions(+), 90 deletions(-)
diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index 37bb04eecd7..73159df3563 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -52,7 +52,7 @@ static void *(*p_vkGetInstanceProcAddr)(VkInstance, const char *); struct surface { VkSurfaceKHR host_surface; - VkSurfaceKHR driver_surface; + void *driver_private; HWND hwnd; };
@@ -76,14 +76,13 @@ static VkResult win32u_vkCreateWin32SurfaceKHR( VkInstance instance, const VkWin if (allocator) FIXME( "Support for allocation callbacks not implemented yet\n" );
if (!(surface = calloc( 1, sizeof(*surface) ))) return VK_ERROR_OUT_OF_HOST_MEMORY; - if ((res = driver_funcs.p_vulkan_surface_create( info->hwnd, instance, &surface->driver_surface ))) + if ((res = driver_funcs.p_vulkan_surface_create( info->hwnd, instance, &surface->host_surface, &surface->driver_private ))) { free( surface ); return res; }
surface->hwnd = info->hwnd; - surface->host_surface = driver_funcs.p_wine_get_host_surface( surface->driver_surface ); *handle = surface_to_handle( surface ); return VK_SUCCESS; } @@ -96,7 +95,7 @@ static void win32u_vkDestroySurfaceKHR( VkInstance instance, VkSurfaceKHR handle if (allocator) FIXME( "Support for allocation callbacks not implemented yet\n" );
p_vkDestroySurfaceKHR( instance, surface->host_surface, NULL /* allocator */ ); - driver_funcs.p_vulkan_surface_destroy( surface->hwnd, surface->driver_surface ); + driver_funcs.p_vulkan_surface_destroy( surface->hwnd, surface->driver_private ); free( surface ); }
@@ -164,13 +163,13 @@ static struct vulkan_funcs vulkan_funcs = .p_wine_get_host_surface = win32u_wine_get_host_surface, };
-static VkResult nulldrv_vulkan_surface_create( HWND hwnd, VkInstance instance, VkSurfaceKHR *surface ) +static VkResult nulldrv_vulkan_surface_create( HWND hwnd, VkInstance instance, VkSurfaceKHR *surface, void **private ) { FIXME( "stub!\n" ); return VK_ERROR_INCOMPATIBLE_DRIVER; }
-static void nulldrv_vulkan_surface_destroy( HWND hwnd, VkSurfaceKHR surface ) +static void nulldrv_vulkan_surface_destroy( HWND hwnd, void *private ) { }
@@ -188,11 +187,6 @@ static const char *nulldrv_get_host_surface_extension(void) return "VK_WINE_nulldrv_surface"; }
-static VkSurfaceKHR nulldrv_wine_get_host_surface( VkSurfaceKHR surface ) -{ - return surface; -} - static const struct vulkan_driver_funcs nulldrv_funcs = { .p_vulkan_surface_create = nulldrv_vulkan_surface_create, @@ -200,7 +194,6 @@ static const struct vulkan_driver_funcs nulldrv_funcs = .p_vulkan_surface_presented = nulldrv_vulkan_surface_presented, .p_vkGetPhysicalDeviceWin32PresentationSupportKHR = nulldrv_vkGetPhysicalDeviceWin32PresentationSupportKHR, .p_get_host_surface_extension = nulldrv_get_host_surface_extension, - .p_wine_get_host_surface = nulldrv_wine_get_host_surface, };
static void vulkan_init(void) diff --git a/dlls/winemac.drv/vulkan.c b/dlls/winemac.drv/vulkan.c index c4747196f04..b6d44bdc906 100644 --- a/dlls/winemac.drv/vulkan.c +++ b/dlls/winemac.drv/vulkan.c @@ -56,7 +56,6 @@ struct wine_vk_surface { macdrv_metal_device device; macdrv_metal_view view; - VkSurfaceKHR host_surface; /* host surface */ };
typedef struct VkMacOSSurfaceCreateInfoMVK @@ -81,11 +80,6 @@ static VkResult (*pvkGetPhysicalDeviceSurfaceCapabilities2KHR)(VkPhysicalDevice,
static const struct vulkan_driver_funcs macdrv_vulkan_driver_funcs;
-static inline struct wine_vk_surface *surface_from_handle(VkSurfaceKHR handle) -{ - return (struct wine_vk_surface *)(uintptr_t)handle; -} - static void wine_vk_surface_destroy(struct wine_vk_surface *surface) { if (surface->view) @@ -97,13 +91,13 @@ static void wine_vk_surface_destroy(struct wine_vk_surface *surface) free(surface); }
-static VkResult macdrv_vulkan_surface_create(HWND hwnd, VkInstance instance, VkSurfaceKHR *surface) +static VkResult macdrv_vulkan_surface_create(HWND hwnd, VkInstance instance, VkSurfaceKHR *surface, void **private) { VkResult res; struct wine_vk_surface *mac_surface; struct macdrv_win_data *data;
- TRACE("%p %p %p\n", hwnd, instance, surface); + TRACE("%p %p %p %p\n", hwnd, instance, surface, private);
if (!(data = get_win_data(hwnd))) { @@ -144,7 +138,7 @@ static VkResult macdrv_vulkan_surface_create(HWND hwnd, VkInstance instance, VkS create_info_host.flags = 0; /* reserved */ create_info_host.pLayer = macdrv_view_get_metal_layer(mac_surface->view);
- res = pvkCreateMetalSurfaceEXT(instance, &create_info_host, NULL /* allocator */, &mac_surface->host_surface); + res = pvkCreateMetalSurfaceEXT(instance, &create_info_host, NULL /* allocator */, surface); } else { @@ -154,7 +148,7 @@ static VkResult macdrv_vulkan_surface_create(HWND hwnd, VkInstance instance, VkS create_info_host.flags = 0; /* reserved */ create_info_host.pView = macdrv_view_get_metal_layer(mac_surface->view);
- res = pvkCreateMacOSSurfaceMVK(instance, &create_info_host, NULL /* allocator */, &mac_surface->host_surface); + res = pvkCreateMacOSSurfaceMVK(instance, &create_info_host, NULL /* allocator */, surface); } if (res != VK_SUCCESS) { @@ -162,11 +156,11 @@ static VkResult macdrv_vulkan_surface_create(HWND hwnd, VkInstance instance, VkS goto err; }
- *surface = (uintptr_t)mac_surface; - release_win_data(data);
- TRACE("Created surface=0x%s\n", wine_dbgstr_longlong(*surface)); + *private = mac_surface; + + TRACE("Created surface=0x%s, private=%p\n", wine_dbgstr_longlong(*surface), *private); return VK_SUCCESS;
err: @@ -175,11 +169,11 @@ err: return res; }
-static void macdrv_vulkan_surface_destroy(HWND hwnd, VkSurfaceKHR surface) +static void macdrv_vulkan_surface_destroy(HWND hwnd, void *private) { - struct wine_vk_surface *mac_surface = surface_from_handle(surface); + struct wine_vk_surface *mac_surface = private;
- TRACE("%p 0x%s\n", hwnd, wine_dbgstr_longlong(surface)); + TRACE("%p %p\n", hwnd, private);
wine_vk_surface_destroy(mac_surface); } @@ -201,15 +195,6 @@ static const char *macdrv_get_host_surface_extension(void) return pvkCreateMetalSurfaceEXT ? "VK_EXT_metal_surface" : "VK_MVK_macos_surface"; }
-static VkSurfaceKHR macdrv_wine_get_host_surface(VkSurfaceKHR surface) -{ - struct wine_vk_surface *mac_surface = surface_from_handle(surface); - - TRACE("0x%s\n", wine_dbgstr_longlong(surface)); - - return mac_surface->host_surface; -} - static const struct vulkan_driver_funcs macdrv_vulkan_driver_funcs = { .p_vulkan_surface_create = macdrv_vulkan_surface_create, @@ -218,7 +203,6 @@ static const struct vulkan_driver_funcs macdrv_vulkan_driver_funcs =
.p_vkGetPhysicalDeviceWin32PresentationSupportKHR = macdrv_vkGetPhysicalDeviceWin32PresentationSupportKHR, .p_get_host_surface_extension = macdrv_get_host_surface_extension, - .p_wine_get_host_surface = macdrv_wine_get_host_surface, };
UINT macdrv_VulkanInit(UINT version, void *vulkan_handle, struct vulkan_driver_funcs *driver_funcs) diff --git a/dlls/winewayland.drv/vulkan.c b/dlls/winewayland.drv/vulkan.c index ce7b0fc3e92..cec270383af 100644 --- a/dlls/winewayland.drv/vulkan.c +++ b/dlls/winewayland.drv/vulkan.c @@ -61,14 +61,8 @@ static const struct vulkan_driver_funcs wayland_vulkan_driver_funcs; struct wine_vk_surface { struct wayland_client_surface *client; - VkSurfaceKHR host_surface; };
-static struct wine_vk_surface *wine_vk_surface_from_handle(VkSurfaceKHR handle) -{ - return (struct wine_vk_surface *)(uintptr_t)handle; -} - static HWND wine_vk_surface_get_hwnd(struct wine_vk_surface *wine_vk_surface) { return wl_surface_get_user_data(wine_vk_surface->client->wl_surface); @@ -93,21 +87,20 @@ static void wine_vk_surface_destroy(struct wine_vk_surface *wine_vk_surface) free(wine_vk_surface); }
-static VkResult wayland_vulkan_surface_create(HWND hwnd, VkInstance instance, VkSurfaceKHR *vk_surface) +static VkResult wayland_vulkan_surface_create(HWND hwnd, VkInstance instance, VkSurfaceKHR *surface, void **private) { VkResult res; VkWaylandSurfaceCreateInfoKHR create_info_host; struct wine_vk_surface *wine_vk_surface; struct wayland_surface *wayland_surface;
- TRACE("%p %p %p\n", hwnd, instance, vk_surface); + TRACE("%p %p %p %p\n", hwnd, instance, surface, private);
wine_vk_surface = calloc(1, sizeof(*wine_vk_surface)); if (!wine_vk_surface) { ERR("Failed to allocate memory for wayland vulkan surface\n"); - res = VK_ERROR_OUT_OF_HOST_MEMORY; - goto err; + return VK_ERROR_OUT_OF_HOST_MEMORY; }
wayland_surface = wayland_surface_lock_hwnd(hwnd); @@ -138,28 +131,28 @@ static VkResult wayland_vulkan_surface_create(HWND hwnd, VkInstance instance, Vk
res = pvkCreateWaylandSurfaceKHR(instance, &create_info_host, NULL /* allocator */, - &wine_vk_surface->host_surface); + surface); if (res != VK_SUCCESS) { ERR("Failed to create vulkan wayland surface, res=%d\n", res); goto err; }
- *vk_surface = (uintptr_t)wine_vk_surface; + *private = wine_vk_surface;
- TRACE("Created surface=0x%s\n", wine_dbgstr_longlong(*vk_surface)); + TRACE("Created surface=0x%s, private=%p\n", wine_dbgstr_longlong(*surface), *private); return VK_SUCCESS;
err: - if (wine_vk_surface) wine_vk_surface_destroy(wine_vk_surface); + wine_vk_surface_destroy(wine_vk_surface); return res; }
-static void wayland_vulkan_surface_destroy(HWND hwnd, VkSurfaceKHR surface) +static void wayland_vulkan_surface_destroy(HWND hwnd, void *private) { - struct wine_vk_surface *wine_vk_surface = wine_vk_surface_from_handle(surface); + struct wine_vk_surface *wine_vk_surface = private;
- TRACE("%p 0x%s\n", hwnd, wine_dbgstr_longlong(surface)); + TRACE("%p %p\n", hwnd, private);
wine_vk_surface_destroy(wine_vk_surface); } @@ -199,11 +192,6 @@ static const char *wayland_get_host_surface_extension(void) return "VK_KHR_wayland_surface"; }
-static VkSurfaceKHR wayland_wine_get_host_surface(VkSurfaceKHR surface) -{ - return wine_vk_surface_from_handle(surface)->host_surface; -} - static const struct vulkan_driver_funcs wayland_vulkan_driver_funcs = { .p_vulkan_surface_create = wayland_vulkan_surface_create, @@ -212,7 +200,6 @@ static const struct vulkan_driver_funcs wayland_vulkan_driver_funcs =
.p_vkGetPhysicalDeviceWin32PresentationSupportKHR = wayland_vkGetPhysicalDeviceWin32PresentationSupportKHR, .p_get_host_surface_extension = wayland_get_host_surface_extension, - .p_wine_get_host_surface = wayland_wine_get_host_surface, };
/********************************************************************** diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 67f3e881d31..92b8d2000b1 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -59,7 +59,6 @@ struct wine_vk_surface LONG ref; struct list entry; Window window; - VkSurfaceKHR host_surface; HWND hwnd; DWORD hwnd_thread_id; }; @@ -78,11 +77,6 @@ static VkBool32 (*pvkGetPhysicalDeviceXlibPresentationSupportKHR)(VkPhysicalDevi
static const struct vulkan_driver_funcs x11drv_vulkan_driver_funcs;
-static inline struct wine_vk_surface *surface_from_handle(VkSurfaceKHR handle) -{ - return (struct wine_vk_surface *)(uintptr_t)handle; -} - static void wine_vk_surface_release( struct wine_vk_surface *surface ) { if (InterlockedDecrement(&surface->ref)) @@ -131,13 +125,13 @@ void vulkan_thread_detach(void) pthread_mutex_unlock(&vulkan_mutex); }
-static VkResult X11DRV_vulkan_surface_create( HWND hwnd, VkInstance instance, VkSurfaceKHR *surface ) +static VkResult X11DRV_vulkan_surface_create( HWND hwnd, VkInstance instance, VkSurfaceKHR *surface, void **private ) { VkResult res; VkXlibSurfaceCreateInfoKHR create_info_host; struct wine_vk_surface *x11_surface;
- TRACE( "%p %p %p\n", hwnd, instance, surface ); + TRACE( "%p %p %p %p\n", hwnd, instance, surface, private );
/* TODO: support child window rendering. */ if (NtUserGetAncestor( hwnd, GA_PARENT ) != NtUserGetDesktopWindow()) @@ -157,7 +151,7 @@ static VkResult X11DRV_vulkan_surface_create( HWND hwnd, VkInstance instance, Vk
if (!x11_surface->window) { - ERR( "Failed to allocate client window for hwnd=%p\n", hwnd ); + ERR("Failed to allocate client window for hwnd=%p\n", hwnd);
/* VK_KHR_win32_surface only allows out of host and device memory as errors. */ free(x11_surface); @@ -170,7 +164,7 @@ static VkResult X11DRV_vulkan_surface_create( HWND hwnd, VkInstance instance, Vk create_info_host.dpy = gdi_display; create_info_host.window = x11_surface->window;
- res = pvkCreateXlibSurfaceKHR( instance, &create_info_host, NULL /* allocator */, &x11_surface->host_surface ); + res = pvkCreateXlibSurfaceKHR( instance, &create_info_host, NULL /* allocator */, surface ); if (res != VK_SUCCESS) { ERR("Failed to create Xlib surface, res=%d\n", res); @@ -183,17 +177,17 @@ static VkResult X11DRV_vulkan_surface_create( HWND hwnd, VkInstance instance, Vk list_add_tail(&surface_list, &x11_surface->entry); pthread_mutex_unlock(&vulkan_mutex);
- *surface = (uintptr_t)x11_surface; + *private = x11_surface;
- TRACE("Created surface=0x%s\n", wine_dbgstr_longlong(*surface)); + TRACE("Created surface 0x%s, private %p\n", wine_dbgstr_longlong(*surface), *private); return VK_SUCCESS; }
-static void X11DRV_vulkan_surface_destroy( HWND hwnd, VkSurfaceKHR surface ) +static void X11DRV_vulkan_surface_destroy( HWND hwnd, void *private ) { - struct wine_vk_surface *x11_surface = surface_from_handle(surface); + struct wine_vk_surface *x11_surface = private;
- TRACE( "%p 0x%s\n", hwnd, wine_dbgstr_longlong(surface) ); + TRACE( "%p %p\n", hwnd, private );
wine_vk_surface_release(x11_surface); } @@ -216,15 +210,6 @@ static const char *X11DRV_get_host_surface_extension(void) return "VK_KHR_xlib_surface"; }
-static VkSurfaceKHR X11DRV_wine_get_host_surface( VkSurfaceKHR surface ) -{ - struct wine_vk_surface *x11_surface = surface_from_handle(surface); - - TRACE("0x%s\n", wine_dbgstr_longlong(surface)); - - return x11_surface->host_surface; -} - static const struct vulkan_driver_funcs x11drv_vulkan_driver_funcs = { .p_vulkan_surface_create = X11DRV_vulkan_surface_create, @@ -233,7 +218,6 @@ static const struct vulkan_driver_funcs x11drv_vulkan_driver_funcs =
.p_vkGetPhysicalDeviceWin32PresentationSupportKHR = X11DRV_vkGetPhysicalDeviceWin32PresentationSupportKHR, .p_get_host_surface_extension = X11DRV_get_host_surface_extension, - .p_wine_get_host_surface = X11DRV_wine_get_host_surface, };
UINT X11DRV_VulkanInit( UINT version, void *vulkan_handle, struct vulkan_driver_funcs *driver_funcs ) diff --git a/include/wine/vulkan_driver.h b/include/wine/vulkan_driver.h index 20931374ce2..c5b2f82234a 100644 --- a/include/wine/vulkan_driver.h +++ b/include/wine/vulkan_driver.h @@ -21,7 +21,7 @@ #define __WINE_VULKAN_DRIVER_H
/* Wine internal vulkan driver version, needs to be bumped upon vulkan_funcs changes. */ -#define WINE_VULKAN_DRIVER_VERSION 32 +#define WINE_VULKAN_DRIVER_VERSION 33
struct vulkan_funcs { @@ -44,13 +44,12 @@ struct vulkan_funcs /* interface between win32u and the user drivers */ struct vulkan_driver_funcs { - VkResult (*p_vulkan_surface_create)(HWND, VkInstance, VkSurfaceKHR *); - void (*p_vulkan_surface_destroy)(HWND, VkSurfaceKHR); + VkResult (*p_vulkan_surface_create)(HWND, VkInstance, VkSurfaceKHR *, void **); + void (*p_vulkan_surface_destroy)(HWND, void *); void (*p_vulkan_surface_presented)(HWND, VkResult);
VkBool32 (*p_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice, uint32_t); const char *(*p_get_host_surface_extension)(void); - VkSurfaceKHR (*p_wine_get_host_surface)(VkSurfaceKHR); };
#endif /* __WINE_VULKAN_DRIVER_H */
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winewayland.drv/vulkan.c | 65 +++++++++++------------------------ 1 file changed, 20 insertions(+), 45 deletions(-)
diff --git a/dlls/winewayland.drv/vulkan.c b/dlls/winewayland.drv/vulkan.c index cec270383af..08d53018162 100644 --- a/dlls/winewayland.drv/vulkan.c +++ b/dlls/winewayland.drv/vulkan.c @@ -58,76 +58,54 @@ static VkBool32 (*pvkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalD
static const struct vulkan_driver_funcs wayland_vulkan_driver_funcs;
-struct wine_vk_surface +static HWND wine_vk_surface_get_hwnd(struct wayland_client_surface *client) { - struct wayland_client_surface *client; -}; - -static HWND wine_vk_surface_get_hwnd(struct wine_vk_surface *wine_vk_surface) -{ - return wl_surface_get_user_data(wine_vk_surface->client->wl_surface); + return wl_surface_get_user_data(client->wl_surface); }
-static void wine_vk_surface_destroy(struct wine_vk_surface *wine_vk_surface) +static void wine_vk_surface_destroy(struct wayland_client_surface *client) { - if (wine_vk_surface->client) - { - HWND hwnd = wine_vk_surface_get_hwnd(wine_vk_surface); - struct wayland_surface *wayland_surface = wayland_surface_lock_hwnd(hwnd); + HWND hwnd = wine_vk_surface_get_hwnd(client); + struct wayland_surface *wayland_surface = wayland_surface_lock_hwnd(hwnd);
- if (wayland_client_surface_release(wine_vk_surface->client) && - wayland_surface) - { - wayland_surface->client = NULL; - } - - if (wayland_surface) pthread_mutex_unlock(&wayland_surface->mutex); + if (wayland_client_surface_release(client) && wayland_surface) + { + wayland_surface->client = NULL; }
- free(wine_vk_surface); + if (wayland_surface) pthread_mutex_unlock(&wayland_surface->mutex); }
static VkResult wayland_vulkan_surface_create(HWND hwnd, VkInstance instance, VkSurfaceKHR *surface, void **private) { VkResult res; VkWaylandSurfaceCreateInfoKHR create_info_host; - struct wine_vk_surface *wine_vk_surface; struct wayland_surface *wayland_surface; + struct wayland_client_surface *client;
TRACE("%p %p %p %p\n", hwnd, instance, surface, private);
- wine_vk_surface = calloc(1, sizeof(*wine_vk_surface)); - if (!wine_vk_surface) - { - ERR("Failed to allocate memory for wayland vulkan surface\n"); - return VK_ERROR_OUT_OF_HOST_MEMORY; - } - wayland_surface = wayland_surface_lock_hwnd(hwnd); if (!wayland_surface) { ERR("Failed to find wayland surface for hwnd=%p\n", hwnd); - /* VK_KHR_win32_surface only allows out of host and device memory as errors. */ - res = VK_ERROR_OUT_OF_HOST_MEMORY; - goto err; + return VK_ERROR_OUT_OF_HOST_MEMORY; }
- wine_vk_surface->client = wayland_surface_get_client(wayland_surface); + client = wayland_surface_get_client(wayland_surface); pthread_mutex_unlock(&wayland_surface->mutex);
- if (!wine_vk_surface->client) + if (!client) { ERR("Failed to create client surface for hwnd=%p\n", hwnd); - /* VK_KHR_win32_surface only allows out of host and device memory as errors. */ - res = VK_ERROR_OUT_OF_HOST_MEMORY; - goto err; + return VK_ERROR_OUT_OF_HOST_MEMORY; }
create_info_host.sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR; create_info_host.pNext = NULL; create_info_host.flags = 0; /* reserved */ create_info_host.display = process_wayland.wl_display; - create_info_host.surface = wine_vk_surface->client->wl_surface; + create_info_host.surface = client->wl_surface;
res = pvkCreateWaylandSurfaceKHR(instance, &create_info_host, NULL /* allocator */, @@ -135,26 +113,23 @@ static VkResult wayland_vulkan_surface_create(HWND hwnd, VkInstance instance, Vk if (res != VK_SUCCESS) { ERR("Failed to create vulkan wayland surface, res=%d\n", res); - goto err; + wine_vk_surface_destroy(client); + return res; }
- *private = wine_vk_surface; + *private = client;
TRACE("Created surface=0x%s, private=%p\n", wine_dbgstr_longlong(*surface), *private); return VK_SUCCESS; - -err: - wine_vk_surface_destroy(wine_vk_surface); - return res; }
static void wayland_vulkan_surface_destroy(HWND hwnd, void *private) { - struct wine_vk_surface *wine_vk_surface = private; + struct wayland_client_surface *client = private;
TRACE("%p %p\n", hwnd, private);
- wine_vk_surface_destroy(wine_vk_surface); + wine_vk_surface_destroy(client); }
static void wayland_vulkan_surface_presented(HWND hwnd, VkResult result)
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/ntuser_private.h | 5 +++++ dlls/win32u/sysparams.c | 1 + dlls/win32u/vulkan.c | 37 ++++++++++++++++++++++++++++++++++++ dlls/win32u/window.c | 2 ++ 4 files changed, 45 insertions(+)
diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index bb2169998b6..704ca4e04e4 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -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,10 @@ 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_window_detach( WND *win ); +extern void vulkan_thread_detach(void); + /* window.c */ HANDLE alloc_user_handle( struct user_object *ptr, unsigned int type ); void *free_user_handle( HANDLE handle, unsigned int type ); diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 7415768d40d..aaac0167de2 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -6224,6 +6224,7 @@ static void thread_detach(void) { struct user_thread_info *thread_info = get_user_thread_info();
+ vulkan_thread_detach(); user_driver->pThreadDetach();
free( thread_info->key_state ); diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index 73159df3563..4747e313598 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -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,31 @@ static void vulkan_init(void) #undef LOAD_FUNCPTR }
+void vulkan_window_detach( WND *win ) +{ + struct surface *surface; + + LIST_FOR_EACH_ENTRY( surface, &win->vulkan_surfaces, struct surface, entry ) + { + list_remove( &surface->entry ); + list_init( &surface->entry ); + } +} + +void vulkan_thread_detach(void) +{ + HANDLE handle = 0; + WND *win; + + user_lock(); + while ((win = next_process_user_handle_ptr( &handle, NTUSER_OBJ_WINDOW ))) + { + if (win->tid != GetCurrentThreadId()) continue; + vulkan_window_detach( win ); + } + user_unlock(); +} + /*********************************************************************** * __wine_get_vulkan_driver (win32u.so) */ diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 73a0fa9e896..a27a40ba2be 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -4763,6 +4763,7 @@ LRESULT destroy_window( HWND hwnd ) window_surface_release( surface ); }
+ vulkan_window_detach( win ); user_driver->pDestroyWindow( hwnd );
free_window_handle( hwnd ); @@ -4987,6 +4988,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;
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/vulkan.c | 6 +++++ dlls/winemac.drv/vulkan.c | 5 +++++ dlls/winewayland.drv/vulkan.c | 5 +++++ dlls/winex11.drv/vulkan.c | 41 +++++++++++++--------------------- dlls/winex11.drv/window.c | 3 +-- dlls/winex11.drv/x11drv.h | 2 +- dlls/winex11.drv/x11drv_main.c | 1 - include/wine/vulkan_driver.h | 3 ++- 8 files changed, 35 insertions(+), 31 deletions(-)
diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index 4747e313598..b7b5f54c303 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -185,6 +185,10 @@ static void nulldrv_vulkan_surface_destroy( HWND hwnd, void *private ) { }
+static void nulldrv_vulkan_surface_detach( HWND hwnd, void *private ) +{ +} + static void nulldrv_vulkan_surface_presented( HWND hwnd, VkResult result ) { } @@ -203,6 +207,7 @@ static const struct vulkan_driver_funcs nulldrv_funcs = { .p_vulkan_surface_create = nulldrv_vulkan_surface_create, .p_vulkan_surface_destroy = nulldrv_vulkan_surface_destroy, + .p_vulkan_surface_detach = nulldrv_vulkan_surface_detach, .p_vulkan_surface_presented = nulldrv_vulkan_surface_presented, .p_vkGetPhysicalDeviceWin32PresentationSupportKHR = nulldrv_vkGetPhysicalDeviceWin32PresentationSupportKHR, .p_get_host_surface_extension = nulldrv_get_host_surface_extension, @@ -257,6 +262,7 @@ void vulkan_window_detach( WND *win )
LIST_FOR_EACH_ENTRY( surface, &win->vulkan_surfaces, struct surface, entry ) { + driver_funcs.p_vulkan_surface_detach( surface->hwnd, surface->driver_private ); list_remove( &surface->entry ); list_init( &surface->entry ); } diff --git a/dlls/winemac.drv/vulkan.c b/dlls/winemac.drv/vulkan.c index b6d44bdc906..1dba486c09a 100644 --- a/dlls/winemac.drv/vulkan.c +++ b/dlls/winemac.drv/vulkan.c @@ -178,6 +178,10 @@ static void macdrv_vulkan_surface_destroy(HWND hwnd, void *private) wine_vk_surface_destroy(mac_surface); }
+static void macdrv_vulkan_surface_detach(HWND hwnd, void *private) +{ +} + static void macdrv_vulkan_surface_presented(HWND hwnd, VkResult result) { } @@ -199,6 +203,7 @@ static const struct vulkan_driver_funcs macdrv_vulkan_driver_funcs = { .p_vulkan_surface_create = macdrv_vulkan_surface_create, .p_vulkan_surface_destroy = macdrv_vulkan_surface_destroy, + .p_vulkan_surface_detach = macdrv_vulkan_surface_detach, .p_vulkan_surface_presented = macdrv_vulkan_surface_presented,
.p_vkGetPhysicalDeviceWin32PresentationSupportKHR = macdrv_vkGetPhysicalDeviceWin32PresentationSupportKHR, diff --git a/dlls/winewayland.drv/vulkan.c b/dlls/winewayland.drv/vulkan.c index 08d53018162..a6c97492e3e 100644 --- a/dlls/winewayland.drv/vulkan.c +++ b/dlls/winewayland.drv/vulkan.c @@ -132,6 +132,10 @@ static void wayland_vulkan_surface_destroy(HWND hwnd, void *private) wine_vk_surface_destroy(client); }
+static void wayland_vulkan_surface_detach(HWND hwnd, void *private) +{ +} + static void wayland_vulkan_surface_presented(HWND hwnd, VkResult result) { struct wayland_surface *wayland_surface; @@ -171,6 +175,7 @@ static const struct vulkan_driver_funcs wayland_vulkan_driver_funcs = { .p_vulkan_surface_create = wayland_vulkan_surface_create, .p_vulkan_surface_destroy = wayland_vulkan_surface_destroy, + .p_vulkan_surface_detach = wayland_vulkan_surface_detach, .p_vulkan_surface_presented = wayland_vulkan_surface_presented,
.p_vkGetPhysicalDeviceWin32PresentationSupportKHR = wayland_vkGetPhysicalDeviceWin32PresentationSupportKHR, diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 92b8d2000b1..79928895fab 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -107,24 +107,6 @@ void destroy_vk_surface( HWND hwnd ) pthread_mutex_unlock( &vulkan_mutex ); }
-void vulkan_thread_detach(void) -{ - struct wine_vk_surface *surface, *next; - DWORD thread_id = GetCurrentThreadId(); - - pthread_mutex_lock(&vulkan_mutex); - LIST_FOR_EACH_ENTRY_SAFE(surface, next, &surface_list, struct wine_vk_surface, entry) - { - if (surface->hwnd_thread_id != thread_id) - continue; - - TRACE("Detaching surface %p, hwnd %p.\n", surface, surface->hwnd); - XReparentWindow(gdi_display, surface->window, get_dummy_parent(), 0, 0); - XSync(gdi_display, False); - } - pthread_mutex_unlock(&vulkan_mutex); -} - static VkResult X11DRV_vulkan_surface_create( HWND hwnd, VkInstance instance, VkSurfaceKHR *surface, void **private ) { VkResult res; @@ -192,6 +174,20 @@ static void X11DRV_vulkan_surface_destroy( HWND hwnd, void *private ) wine_vk_surface_release(x11_surface); }
+static void X11DRV_vulkan_surface_detach( HWND hwnd, void *private ) +{ + struct wine_vk_surface *x11_surface = private; + struct x11drv_win_data *data; + + TRACE( "%p %p\n", hwnd, private ); + + if ((data = get_win_data( hwnd ))) + { + detach_client_window( data, x11_surface->window ); + release_win_data( data ); + } +} + static void X11DRV_vulkan_surface_presented(HWND hwnd, VkResult result) { } @@ -214,6 +210,7 @@ static const struct vulkan_driver_funcs x11drv_vulkan_driver_funcs = { .p_vulkan_surface_create = X11DRV_vulkan_surface_create, .p_vulkan_surface_destroy = X11DRV_vulkan_surface_destroy, + .p_vulkan_surface_detach = X11DRV_vulkan_surface_detach, .p_vulkan_surface_presented = X11DRV_vulkan_surface_presented,
.p_vkGetPhysicalDeviceWin32PresentationSupportKHR = X11DRV_vkGetPhysicalDeviceWin32PresentationSupportKHR, @@ -247,12 +244,4 @@ UINT X11DRV_VulkanInit( UINT version, void *vulkan_handle, struct vulkan_driver_ return STATUS_NOT_IMPLEMENTED; }
-void destroy_vk_surface( HWND hwnd ) -{ -} - -void vulkan_thread_detach(void) -{ -} - #endif /* SONAME_LIBVULKAN */ diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 26cfee427ab..921318e81a0 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1604,7 +1604,7 @@ static void client_window_events_disable( struct x11drv_win_data *data, Window c /********************************************************************** * detach_client_window */ -static void detach_client_window( struct x11drv_win_data *data, Window client_window ) +void detach_client_window( struct x11drv_win_data *data, Window client_window ) { if (data->client_window != client_window || !client_window) return;
@@ -1940,7 +1940,6 @@ void X11DRV_DestroyWindow( HWND hwnd ) release_win_data( data ); free( data ); destroy_gl_drawable( hwnd ); - destroy_vk_surface( hwnd ); }
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index ef7a9ce98bf..e273714c0f3 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -641,7 +641,6 @@ extern void sync_gl_drawable( HWND hwnd, BOOL known_child ); extern void set_gl_drawable_parent( HWND hwnd, HWND parent ); extern void destroy_gl_drawable( HWND hwnd ); extern void destroy_vk_surface( HWND hwnd ); -extern void vulkan_thread_detach(void);
extern void wait_for_withdrawn_state( HWND hwnd, BOOL set ); extern Window init_clip_window(void); @@ -650,6 +649,7 @@ extern void read_net_wm_states( Display *display, struct x11drv_win_data *data ) extern void update_net_wm_states( struct x11drv_win_data *data ); extern void make_window_embedded( struct x11drv_win_data *data ); extern Window create_client_window( HWND hwnd, const XVisualInfo *visual, Colormap colormap ); +extern void detach_client_window( struct x11drv_win_data *data, Window client_window ); extern void destroy_client_window( HWND hwnd, Window client_window ); extern void set_window_visual( struct x11drv_win_data *data, const XVisualInfo *vis, BOOL use_alpha ); extern void change_systray_owner( Display *display, Window systray_window ); diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 4c8fd943ffd..180573128e7 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -696,7 +696,6 @@ void X11DRV_ThreadDetach(void)
if (data) { - vulkan_thread_detach(); if (data->xim) XCloseIM( data->xim ); if (data->font_set) XFreeFontSet( data->display, data->font_set ); XSync( gdi_display, False ); /* make sure XReparentWindow requests have completed before closing the thread display */ diff --git a/include/wine/vulkan_driver.h b/include/wine/vulkan_driver.h index c5b2f82234a..7ddba4739f4 100644 --- a/include/wine/vulkan_driver.h +++ b/include/wine/vulkan_driver.h @@ -21,7 +21,7 @@ #define __WINE_VULKAN_DRIVER_H
/* Wine internal vulkan driver version, needs to be bumped upon vulkan_funcs changes. */ -#define WINE_VULKAN_DRIVER_VERSION 33 +#define WINE_VULKAN_DRIVER_VERSION 34
struct vulkan_funcs { @@ -46,6 +46,7 @@ struct vulkan_driver_funcs { VkResult (*p_vulkan_surface_create)(HWND, VkInstance, VkSurfaceKHR *, void **); void (*p_vulkan_surface_destroy)(HWND, void *); + void (*p_vulkan_surface_detach)(HWND, void *); void (*p_vulkan_surface_presented)(HWND, VkResult);
VkBool32 (*p_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice, uint32_t);
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winex11.drv/vulkan.c | 97 ++++++--------------------------------- 1 file changed, 15 insertions(+), 82 deletions(-)
diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 79928895fab..f5e61942031 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -48,21 +48,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(vulkan);
#ifdef SONAME_LIBVULKAN
-static pthread_mutex_t vulkan_mutex; - #define VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR 1000004000
-static struct list surface_list = LIST_INIT( surface_list ); - -struct wine_vk_surface -{ - LONG ref; - struct list entry; - Window window; - HWND hwnd; - DWORD hwnd_thread_id; -}; - typedef struct VkXlibSurfaceCreateInfoKHR { VkStructureType sType; @@ -77,41 +64,13 @@ static VkBool32 (*pvkGetPhysicalDeviceXlibPresentationSupportKHR)(VkPhysicalDevi
static const struct vulkan_driver_funcs x11drv_vulkan_driver_funcs;
-static void wine_vk_surface_release( struct wine_vk_surface *surface ) -{ - if (InterlockedDecrement(&surface->ref)) - return; - - if (surface->entry.next) - { - pthread_mutex_lock(&vulkan_mutex); - list_remove(&surface->entry); - pthread_mutex_unlock(&vulkan_mutex); - } - - destroy_client_window( surface->hwnd, surface->window ); - free(surface); -} - -void destroy_vk_surface( HWND hwnd ) -{ - struct wine_vk_surface *surface, *next; - - pthread_mutex_lock( &vulkan_mutex ); - LIST_FOR_EACH_ENTRY_SAFE( surface, next, &surface_list, struct wine_vk_surface, entry ) - { - if (surface->hwnd != hwnd) continue; - surface->hwnd_thread_id = 0; - surface->hwnd = NULL; - } - pthread_mutex_unlock( &vulkan_mutex ); -} - static VkResult X11DRV_vulkan_surface_create( HWND hwnd, VkInstance instance, VkSurfaceKHR *surface, void **private ) { - VkResult res; - VkXlibSurfaceCreateInfoKHR create_info_host; - struct wine_vk_surface *x11_surface; + VkXlibSurfaceCreateInfoKHR info = + { + .sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR, + .dpy = gdi_display, + };
TRACE( "%p %p %p %p\n", hwnd, instance, surface, private );
@@ -122,44 +81,20 @@ static VkResult X11DRV_vulkan_surface_create( HWND hwnd, VkInstance instance, Vk return VK_ERROR_INCOMPATIBLE_DRIVER; }
- x11_surface = calloc(1, sizeof(*x11_surface)); - if (!x11_surface) - return VK_ERROR_OUT_OF_HOST_MEMORY; - - x11_surface->ref = 1; - x11_surface->hwnd = hwnd; - x11_surface->window = create_client_window( hwnd, &default_visual, default_colormap ); - x11_surface->hwnd_thread_id = NtUserGetWindowThread( x11_surface->hwnd, NULL ); - - if (!x11_surface->window) + if (!(info.window = create_client_window( hwnd, &default_visual, default_colormap ))) { ERR("Failed to allocate client window for hwnd=%p\n", hwnd); - - /* VK_KHR_win32_surface only allows out of host and device memory as errors. */ - free(x11_surface); return VK_ERROR_OUT_OF_HOST_MEMORY; }
- create_info_host.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR; - create_info_host.pNext = NULL; - create_info_host.flags = 0; /* reserved */ - create_info_host.dpy = gdi_display; - create_info_host.window = x11_surface->window; - - res = pvkCreateXlibSurfaceKHR( instance, &create_info_host, NULL /* allocator */, surface ); - if (res != VK_SUCCESS) + if (pvkCreateXlibSurfaceKHR( instance, &info, NULL /* allocator */, surface )) { - ERR("Failed to create Xlib surface, res=%d\n", res); - destroy_client_window( x11_surface->hwnd, x11_surface->window ); - free(x11_surface); - return res; + ERR("Failed to create Xlib surface\n"); + destroy_client_window( hwnd, info.window ); + return VK_ERROR_OUT_OF_HOST_MEMORY; }
- pthread_mutex_lock(&vulkan_mutex); - list_add_tail(&surface_list, &x11_surface->entry); - pthread_mutex_unlock(&vulkan_mutex); - - *private = x11_surface; + *private = (void *)info.window;
TRACE("Created surface 0x%s, private %p\n", wine_dbgstr_longlong(*surface), *private); return VK_SUCCESS; @@ -167,23 +102,23 @@ static VkResult X11DRV_vulkan_surface_create( HWND hwnd, VkInstance instance, Vk
static void X11DRV_vulkan_surface_destroy( HWND hwnd, void *private ) { - struct wine_vk_surface *x11_surface = private; + Window client_window = (Window)private;
TRACE( "%p %p\n", hwnd, private );
- wine_vk_surface_release(x11_surface); + destroy_client_window( hwnd, client_window ); }
static void X11DRV_vulkan_surface_detach( HWND hwnd, void *private ) { - struct wine_vk_surface *x11_surface = private; + Window client_window = (Window)private; struct x11drv_win_data *data;
TRACE( "%p %p\n", hwnd, private );
if ((data = get_win_data( hwnd ))) { - detach_client_window( data, x11_surface->window ); + detach_client_window( data, client_window ); release_win_data( data ); } } @@ -225,8 +160,6 @@ UINT X11DRV_VulkanInit( UINT version, void *vulkan_handle, struct vulkan_driver_ return STATUS_INVALID_PARAMETER; }
- init_recursive_mutex( &vulkan_mutex ); - #define LOAD_FUNCPTR( f ) if (!(p##f = dlsym( vulkan_handle, #f ))) return STATUS_PROCEDURE_NOT_FOUND; LOAD_FUNCPTR( vkCreateXlibSurfaceKHR ); LOAD_FUNCPTR( vkGetPhysicalDeviceXlibPresentationSupportKHR );
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=144961
Your paranoid android.
=== debian11b (64 bit WoW report) ===
vulkan-1: vulkan: Timeout
Looks good to me from the Wayland driver point of view.
Jacek Caban (@jacek) commented about dlls/win32u/vulkan.c:
- }
+}
+void vulkan_thread_detach(void) +{
- HANDLE handle = 0;
- WND *win;
- user_lock();
- while ((win = next_process_user_handle_ptr( &handle, NTUSER_OBJ_WINDOW )))
- {
if (win->tid != GetCurrentThreadId()) continue;
vulkan_window_detach( win );
- }
- user_unlock();
+}
Could we do that in `destroy_thread_windows`, where we already iterate windows? The downside of it would be that we'd call the driver after `ThreadDetach`, which is not great, but it should work AFAICT.
We could now make it `const struct vulak_driver_func **` and store the pointer, instead of an instance, in win32u.
Hi, first sorry in advance for joining here to ask some question.. but it's somewhat related to work like this, so let me explain..
I'm interested on testing things that depend on DXVK-NVAPI, mainly DLSS content (like NV Path Tracing SDK for ex.) outside of Proton (i.e. using Wine-staging builds, like Kron4ek builds for ex.)..
on X11 no problem, but on Wayland wasn't working.. but I learned asking here:
https://github.com/jp7677/dxvk-nvapi/issues/165#issuecomment-1983594720
that:
"Upstream Wine relies on xrandr providers to assign LUIDs to GPUs.." etc.. etc
so the issue was related to adapter LUID being NULL on Wayland and that there was a Proton patch to fix the issue:
https://github.com/ValveSoftware/wine/commit/e8801e96fedf67b88e6f3f5d9f9e2d9...
following learning that, asked Kron4ek to integrate patch: https://github.com/Kron4ek/Wine-Builds/issues/124 which kindly agreed..
the thing is, the patch pointed doesn't stand the test of time well, and almost every Wine version requires some changes (not very difficult yet).. which I keep doing and posting here: https://github.com/Kron4ek/Wine-Builds/issues/124
the latest one for Wine 9.6 for ex.: https://github.com/Kron4ek/Wine-Builds/issues/124#issuecomment-2049087722
elaboration on the context done, I'm asking two things:
1) as the changes needed for the patch seems constant and are due to PRs/commits like this, "restructuring" WineX11 and WineWayland Vulkan use, I'm asking if makes sense for me on keeping the patch updated or soon this patch will be unneeded with all your changes (i.e. the support will be builtin on Wine or will be integrated in some way).. also, can share if there is much restructuring remaining, i.e. if the patch will survive better, soon?
2) this question is more demanding, as this patch doesn't cover/work when running DLSS content in new "Wine's 9.0 native wayland mode".. i.e. LUID is NULL running DXVK-NVAPI so DLSS doesn't work.. until now, no much interest, but now, that learned that "Wine's native wayland mode supports HDR through DXVK" via VK_hdr_layer (https://github.com/Zamundaaa/VK_hdr_layer), I'm more interested on running DLSS+HDR content via native Wine Wayland.. as I have really no idea of Wine code, can share how much work would be to do a similar patch (for wineWayland?) so exposing LUIDs correctly when running in native wayland mode? are Wine devs interested in doing a "Wine native wayland" LUID fix patch, one for either Proton or Wine Staging relatively soon? I say this, because at least my testing of Proton 9.x (https://github.com/Kron4ek/Wine-Builds/releases/tag/proton-exp-9.0) shows there is no equivalent support/patch for Proton yet..
to end, as said before can post this issue in other "more appropiate" place if wanted/requested..
would love to have a issues site here in Wine gitlab much like Mesa for issues that are not for posting in www.winehq.org/pipermail/wine-users, right?
thanks..
On Fri Apr 12 18:28:37 2024 +0000, Jacek Caban wrote:
Could we do that in `destroy_thread_windows`, where we already iterate windows? The downside of it would be that we'd call the driver after `ThreadDetach`, which is not great, but it should work AFAICT.
The issue is that winex11 closes its thread display in `ThreadDetach`. This destroys every top-level window that's been created with it, as well as any of the client windows that are still parented to them.
On Wed Apr 24 08:59:33 2024 +0000, Oscar Barenys wrote:
Hi, first sorry in advance for joining here to ask some question.. but it's somewhat related to work like this, so let me explain.. I'm interested on testing things that depend on DXVK-NVAPI, mainly DLSS content (like NV Path Tracing SDK for ex.) outside of Proton (i.e. using Wine-staging builds, like Kron4ek builds for ex.).. on X11 no problem, but on Wayland wasn't working.. but I learned asking here: https://github.com/jp7677/dxvk-nvapi/issues/165#issuecomment-1983594720 that: "Upstream Wine relies on xrandr providers to assign LUIDs to GPUs.." etc.. etc so the issue was related to adapter LUID being NULL on Wayland and that there was a Proton patch to fix the issue: https://github.com/ValveSoftware/wine/commit/e8801e96fedf67b88e6f3f5d9f9e2d9... following learning that, asked Kron4ek to integrate patch: https://github.com/Kron4ek/Wine-Builds/issues/124 which kindly agreed.. the thing is, the patch pointed doesn't stand the test of time well, and almost every Wine version requires some changes (not very difficult yet).. which I keep doing and posting here: https://github.com/Kron4ek/Wine-Builds/issues/124 the latest one for Wine 9.6 for ex.: https://github.com/Kron4ek/Wine-Builds/issues/124#issuecomment-2049087722 elaboration on the context done, I'm asking two things:
- as the changes needed for the patch seems constant and are due to
PRs/commits like this, "restructuring" WineX11 and WineWayland Vulkan use, I'm asking if makes sense for me on keeping the patch updated or soon this patch will be unneeded with all your changes (i.e. the support will be builtin on Wine or will be integrated in some way).. also, can share if there is much restructuring remaining, i.e. if the patch will survive better, soon? 2) this question is more demanding, as this patch doesn't cover/work when running DLSS content in new "Wine's 9.0 native wayland mode".. i.e. LUID is NULL running DXVK-NVAPI so DLSS doesn't work.. until now, no much interest, but now, that learned that "Wine's native wayland mode supports HDR through DXVK" via VK_hdr_layer (https://github.com/Zamundaaa/VK_hdr_layer), I'm more interested on running DLSS+HDR content via native Wine Wayland.. as I have really no idea of Wine code, can share how much work would be to do a similar patch (for wineWayland?) so exposing LUIDs correctly when running in native wayland mode? are Wine devs interested in doing a "Wine native wayland" LUID fix patch, one for either Proton or Wine Staging relatively soon? I say this, because at least my testing of Proton 9.x (https://github.com/Kron4ek/Wine-Builds/releases/tag/proton-exp-9.0) shows there is no equivalent support/patch for Proton yet.. to end, as said before can post this issue in other "more appropiate" place if wanted/requested.. would love to have a issues site here in Wine gitlab much like Mesa for issues that are not for posting in www.winehq.org/pipermail/wine-users, right? thanks..
This is not the best place to discuss unrelated bugs or patches, or workflow in general. It would be better to either open a Bugzilla entry if there's a bug, or send an e-mail to wine-devel if you want to discuss about downstream workflow, or ask for help / advice about maintaining a patch.
Yes, downstream patch maintenance is sometimes a burden, and I'm sorry these changes are causing trouble. We rebase Proton changes every major release, or when we need to cherry-pick upstream changes, but doing that on every upstream change would be too much time consuming. We are very grateful to the community for doing that work, and happy to help as much as we can, but we also cannot keep track of every patch and conflicts out there.
Then, I wasn't even really aware of that patch (even though github says I'm the author I'm sure I'm not), but it looks reasonable, although probably better done in win32u, and I'll send something after https://gitlab.winehq.org/wine/wine/-/merge_requests/5422 is merged.