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 5b6affa2f30..d2323265db9 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 0dde23b0cba..465389fff46 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 e24c344606e..87d2be0042c 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 534f88f515c..2c457f1282f 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);