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

win32u: Move host surface destruction out of the drivers.

parent 34d288a9
......@@ -44,6 +44,7 @@ static void *vulkan_handle;
static const 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
}
......
......@@ -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, const struct vulkan_dr
#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;
......
......@@ -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, const struct vulkan_d
#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
......
......@@ -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, const struct vulkan_d
#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
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment