win32u: Move vulkan loading and init guard out of the drivers.
This commit is contained in:
parent
1ddaa1d385
commit
28873ce8c4
14 changed files with 150 additions and 170 deletions
|
@ -915,9 +915,9 @@ static BOOL nulldrv_SystemParametersInfo( UINT action, UINT int_param, void *ptr
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static const struct vulkan_funcs *nulldrv_wine_get_vulkan_driver( UINT version )
|
||||
static UINT nulldrv_VulkanInit( UINT version, void *vulkan_handle, struct vulkan_funcs *vulkan_funcs )
|
||||
{
|
||||
return NULL;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static struct opengl_funcs *nulldrv_wine_get_wgl_driver( UINT version )
|
||||
|
@ -1231,9 +1231,9 @@ static BOOL loaderdrv_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWI
|
|||
return load_driver()->pUpdateLayeredWindow( hwnd, info, window_rect );
|
||||
}
|
||||
|
||||
static const struct vulkan_funcs * loaderdrv_wine_get_vulkan_driver( UINT version )
|
||||
static UINT loaderdrv_VulkanInit( UINT version, void *vulkan_handle, struct vulkan_funcs *vulkan_funcs )
|
||||
{
|
||||
return load_driver()->pwine_get_vulkan_driver( version );
|
||||
return load_driver()->pVulkanInit( version, vulkan_handle, vulkan_funcs );
|
||||
}
|
||||
|
||||
static const struct user_driver_funcs lazy_load_driver =
|
||||
|
@ -1302,7 +1302,7 @@ static const struct user_driver_funcs lazy_load_driver =
|
|||
/* system parameters */
|
||||
nulldrv_SystemParametersInfo,
|
||||
/* vulkan support */
|
||||
loaderdrv_wine_get_vulkan_driver,
|
||||
loaderdrv_VulkanInit,
|
||||
/* opengl support */
|
||||
nulldrv_wine_get_wgl_driver,
|
||||
/* thread management */
|
||||
|
@ -1386,7 +1386,7 @@ void __wine_set_user_driver( const struct user_driver_funcs *funcs, UINT version
|
|||
SET_USER_FUNC(WindowPosChanging);
|
||||
SET_USER_FUNC(WindowPosChanged);
|
||||
SET_USER_FUNC(SystemParametersInfo);
|
||||
SET_USER_FUNC(wine_get_vulkan_driver);
|
||||
SET_USER_FUNC(VulkanInit);
|
||||
SET_USER_FUNC(wine_get_wgl_driver);
|
||||
SET_USER_FUNC(ThreadDetach);
|
||||
#undef SET_USER_FUNC
|
||||
|
|
|
@ -22,14 +22,70 @@
|
|||
#pragma makedep unix
|
||||
#endif
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include "ntstatus.h"
|
||||
#define WIN32_NO_STATUS
|
||||
#include "win32u_private.h"
|
||||
#include "wine/vulkan.h"
|
||||
#include "wine/vulkan_driver.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(vulkan);
|
||||
|
||||
#ifdef SONAME_LIBVULKAN
|
||||
|
||||
static void *vulkan_handle;
|
||||
static struct vulkan_funcs vulkan_funcs;
|
||||
|
||||
static void vulkan_init(void)
|
||||
{
|
||||
UINT status;
|
||||
|
||||
if (!(vulkan_handle = dlopen( SONAME_LIBVULKAN, RTLD_NOW )))
|
||||
{
|
||||
ERR( "Failed to load %s\n", SONAME_LIBVULKAN );
|
||||
return;
|
||||
}
|
||||
|
||||
if ((status = user_driver->pVulkanInit( WINE_VULKAN_DRIVER_VERSION, vulkan_handle, &vulkan_funcs )) &&
|
||||
status != STATUS_NOT_IMPLEMENTED)
|
||||
{
|
||||
ERR( "Failed to initialize the driver vulkan functions, status %#x\n", status );
|
||||
dlclose( vulkan_handle );
|
||||
vulkan_handle = NULL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* __wine_get_vulkan_driver (win32u.so)
|
||||
*/
|
||||
const struct vulkan_funcs *__wine_get_vulkan_driver( UINT version )
|
||||
{
|
||||
return user_driver->pwine_get_vulkan_driver( version );
|
||||
static pthread_once_t init_once = PTHREAD_ONCE_INIT;
|
||||
|
||||
if (version != WINE_VULKAN_DRIVER_VERSION)
|
||||
{
|
||||
ERR( "version mismatch, vulkan wants %u but win32u has %u\n", version, WINE_VULKAN_DRIVER_VERSION );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pthread_once( &init_once, vulkan_init );
|
||||
return vulkan_handle ? &vulkan_funcs : NULL;
|
||||
}
|
||||
|
||||
#else /* SONAME_LIBVULKAN */
|
||||
|
||||
/***********************************************************************
|
||||
* __wine_get_vulkan_driver (win32u.so)
|
||||
*/
|
||||
const struct vulkan_funcs *__wine_get_vulkan_driver( UINT version )
|
||||
{
|
||||
ERR("Wine was built without Vulkan support.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* SONAME_LIBVULKAN */
|
||||
|
|
|
@ -308,7 +308,7 @@ static const struct user_driver_funcs macdrv_funcs =
|
|||
.pWindowMessage = macdrv_WindowMessage,
|
||||
.pWindowPosChanged = macdrv_WindowPosChanged,
|
||||
.pWindowPosChanging = macdrv_WindowPosChanging,
|
||||
.pwine_get_vulkan_driver = macdrv_wine_get_vulkan_driver,
|
||||
.pVulkanInit = macdrv_VulkanInit,
|
||||
.pwine_get_wgl_driver = macdrv_wine_get_wgl_driver,
|
||||
};
|
||||
|
||||
|
|
|
@ -257,7 +257,7 @@ extern BOOL query_pasteboard_data(HWND hwnd, CFStringRef type);
|
|||
extern void macdrv_lost_pasteboard_ownership(HWND hwnd);
|
||||
|
||||
extern struct opengl_funcs *macdrv_wine_get_wgl_driver(UINT version);
|
||||
extern const struct vulkan_funcs *macdrv_wine_get_vulkan_driver(UINT version);
|
||||
extern UINT macdrv_VulkanInit(UINT version, void *vulkan_handle, struct vulkan_funcs *vulkan_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,
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#include <stdio.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "ntstatus.h"
|
||||
#define WIN32_NO_STATUS
|
||||
#include "macdrv.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
|
@ -96,38 +98,6 @@ static inline struct wine_vk_surface *surface_from_handle(VkSurfaceKHR handle)
|
|||
return (struct wine_vk_surface *)(uintptr_t)handle;
|
||||
}
|
||||
|
||||
static void *vulkan_handle;
|
||||
|
||||
static void wine_vk_init(void)
|
||||
{
|
||||
if (!(vulkan_handle = dlopen(SONAME_LIBVULKAN, RTLD_NOW)))
|
||||
{
|
||||
ERR("Failed to load %s\n", SONAME_LIBVULKAN);
|
||||
return;
|
||||
}
|
||||
|
||||
#define LOAD_FUNCPTR(f) if ((p##f = dlsym(vulkan_handle, #f)) == NULL) goto fail;
|
||||
LOAD_FUNCPTR(vkCreateInstance)
|
||||
LOAD_FUNCPTR(vkCreateSwapchainKHR)
|
||||
LOAD_FUNCPTR(vkCreateMacOSSurfaceMVK)
|
||||
LOAD_FUNCPTR(vkCreateMetalSurfaceEXT)
|
||||
LOAD_FUNCPTR(vkDestroyInstance)
|
||||
LOAD_FUNCPTR(vkDestroySurfaceKHR)
|
||||
LOAD_FUNCPTR(vkDestroySwapchainKHR)
|
||||
LOAD_FUNCPTR(vkEnumerateInstanceExtensionProperties)
|
||||
LOAD_FUNCPTR(vkGetDeviceProcAddr)
|
||||
LOAD_FUNCPTR(vkGetInstanceProcAddr)
|
||||
LOAD_FUNCPTR(vkGetSwapchainImagesKHR)
|
||||
LOAD_FUNCPTR(vkQueuePresentKHR)
|
||||
#undef LOAD_FUNCPTR
|
||||
|
||||
return;
|
||||
|
||||
fail:
|
||||
dlclose(vulkan_handle);
|
||||
vulkan_handle = NULL;
|
||||
}
|
||||
|
||||
/* Helper function for converting between win32 and MoltenVK compatible VkInstanceCreateInfo.
|
||||
* Caller is responsible for allocation and cleanup of 'dst'.
|
||||
*/
|
||||
|
@ -498,34 +468,39 @@ static const struct vulkan_funcs vulkan_funcs =
|
|||
macdrv_wine_get_host_surface,
|
||||
};
|
||||
|
||||
static const struct vulkan_funcs *get_vulkan_driver(UINT version)
|
||||
UINT macdrv_VulkanInit(UINT version, void *vulkan_handle, struct vulkan_funcs *driver_funcs)
|
||||
{
|
||||
static pthread_once_t init_once = PTHREAD_ONCE_INIT;
|
||||
|
||||
if (version != WINE_VULKAN_DRIVER_VERSION)
|
||||
{
|
||||
ERR("version mismatch, vulkan wants %u but driver has %u\n", version, WINE_VULKAN_DRIVER_VERSION);
|
||||
return NULL;
|
||||
ERR("version mismatch, win32u wants %u but driver has %u\n", version, WINE_VULKAN_DRIVER_VERSION);
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
pthread_once(&init_once, wine_vk_init);
|
||||
if (vulkan_handle)
|
||||
return &vulkan_funcs;
|
||||
#define LOAD_FUNCPTR(f) if ((p##f = dlsym(vulkan_handle, #f)) == NULL) return STATUS_PROCEDURE_NOT_FOUND;
|
||||
LOAD_FUNCPTR(vkCreateInstance)
|
||||
LOAD_FUNCPTR(vkCreateSwapchainKHR)
|
||||
LOAD_FUNCPTR(vkCreateMacOSSurfaceMVK)
|
||||
LOAD_FUNCPTR(vkCreateMetalSurfaceEXT)
|
||||
LOAD_FUNCPTR(vkDestroyInstance)
|
||||
LOAD_FUNCPTR(vkDestroySurfaceKHR)
|
||||
LOAD_FUNCPTR(vkDestroySwapchainKHR)
|
||||
LOAD_FUNCPTR(vkEnumerateInstanceExtensionProperties)
|
||||
LOAD_FUNCPTR(vkGetDeviceProcAddr)
|
||||
LOAD_FUNCPTR(vkGetInstanceProcAddr)
|
||||
LOAD_FUNCPTR(vkGetSwapchainImagesKHR)
|
||||
LOAD_FUNCPTR(vkQueuePresentKHR)
|
||||
#undef LOAD_FUNCPTR
|
||||
|
||||
return NULL;
|
||||
*driver_funcs = vulkan_funcs;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#else /* No vulkan */
|
||||
|
||||
static const struct vulkan_funcs *get_vulkan_driver(UINT version)
|
||||
UINT macdrv_VulkanInit(UINT version, void *vulkan_handle, struct vulkan_funcs *driver_funcs)
|
||||
{
|
||||
ERR("Wine was built without Vulkan support.\n");
|
||||
return NULL;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
#endif /* SONAME_LIBVULKAN */
|
||||
|
||||
const struct vulkan_funcs *macdrv_wine_get_vulkan_driver(UINT version)
|
||||
{
|
||||
return get_vulkan_driver( version );
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <dlfcn.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ntstatus.h"
|
||||
#define WIN32_NO_STATUS
|
||||
#include "waylanddrv.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
|
@ -64,7 +66,6 @@ static VkBool32 (*pvkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalD
|
|||
static VkResult (*pvkGetSwapchainImagesKHR)(VkDevice, VkSwapchainKHR, uint32_t *, VkImage *);
|
||||
static VkResult (*pvkQueuePresentKHR)(VkQueue, const VkPresentInfoKHR *);
|
||||
|
||||
static void *vulkan_handle;
|
||||
static const struct vulkan_funcs vulkan_funcs;
|
||||
|
||||
static pthread_mutex_t wine_vk_swapchain_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
@ -542,38 +543,6 @@ static VkSurfaceKHR wayland_wine_get_host_surface(VkSurfaceKHR surface)
|
|||
return wine_vk_surface_from_handle(surface)->host_surface;
|
||||
}
|
||||
|
||||
static void wine_vk_init(void)
|
||||
{
|
||||
if (!(vulkan_handle = dlopen(SONAME_LIBVULKAN, RTLD_NOW)))
|
||||
{
|
||||
ERR("Failed to load %s.\n", SONAME_LIBVULKAN);
|
||||
return;
|
||||
}
|
||||
|
||||
#define LOAD_FUNCPTR(f) if (!(p##f = dlsym(vulkan_handle, #f))) goto fail
|
||||
#define LOAD_OPTIONAL_FUNCPTR(f) p##f = dlsym(vulkan_handle, #f)
|
||||
LOAD_FUNCPTR(vkCreateInstance);
|
||||
LOAD_FUNCPTR(vkCreateSwapchainKHR);
|
||||
LOAD_FUNCPTR(vkCreateWaylandSurfaceKHR);
|
||||
LOAD_FUNCPTR(vkDestroyInstance);
|
||||
LOAD_FUNCPTR(vkDestroySurfaceKHR);
|
||||
LOAD_FUNCPTR(vkDestroySwapchainKHR);
|
||||
LOAD_FUNCPTR(vkEnumerateInstanceExtensionProperties);
|
||||
LOAD_FUNCPTR(vkGetDeviceProcAddr);
|
||||
LOAD_FUNCPTR(vkGetInstanceProcAddr);
|
||||
LOAD_FUNCPTR(vkGetPhysicalDeviceWaylandPresentationSupportKHR);
|
||||
LOAD_FUNCPTR(vkGetSwapchainImagesKHR);
|
||||
LOAD_FUNCPTR(vkQueuePresentKHR);
|
||||
#undef LOAD_FUNCPTR
|
||||
#undef LOAD_OPTIONAL_FUNCPTR
|
||||
|
||||
return;
|
||||
|
||||
fail:
|
||||
dlclose(vulkan_handle);
|
||||
vulkan_handle = NULL;
|
||||
}
|
||||
|
||||
static const struct vulkan_funcs vulkan_funcs =
|
||||
{
|
||||
.p_vkCreateInstance = wayland_vkCreateInstance,
|
||||
|
@ -592,31 +561,41 @@ static const struct vulkan_funcs vulkan_funcs =
|
|||
};
|
||||
|
||||
/**********************************************************************
|
||||
* WAYLAND_wine_get_vulkan_driver
|
||||
* WAYLAND_VulkanInit
|
||||
*/
|
||||
const struct vulkan_funcs *WAYLAND_wine_get_vulkan_driver(UINT version)
|
||||
UINT WAYLAND_VulkanInit(UINT version, void *vulkan_handle, struct vulkan_funcs *driver_funcs)
|
||||
{
|
||||
static pthread_once_t init_once = PTHREAD_ONCE_INIT;
|
||||
|
||||
if (version != WINE_VULKAN_DRIVER_VERSION)
|
||||
{
|
||||
ERR("version mismatch, vulkan wants %u but driver has %u\n", version, WINE_VULKAN_DRIVER_VERSION);
|
||||
return NULL;
|
||||
ERR("version mismatch, win32u wants %u but driver has %u\n", version, WINE_VULKAN_DRIVER_VERSION);
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
pthread_once(&init_once, wine_vk_init);
|
||||
if (vulkan_handle)
|
||||
return &vulkan_funcs;
|
||||
#define LOAD_FUNCPTR(f) if (!(p##f = dlsym(vulkan_handle, #f))) return STATUS_PROCEDURE_NOT_FOUND;
|
||||
LOAD_FUNCPTR(vkCreateInstance);
|
||||
LOAD_FUNCPTR(vkCreateSwapchainKHR);
|
||||
LOAD_FUNCPTR(vkCreateWaylandSurfaceKHR);
|
||||
LOAD_FUNCPTR(vkDestroyInstance);
|
||||
LOAD_FUNCPTR(vkDestroySurfaceKHR);
|
||||
LOAD_FUNCPTR(vkDestroySwapchainKHR);
|
||||
LOAD_FUNCPTR(vkEnumerateInstanceExtensionProperties);
|
||||
LOAD_FUNCPTR(vkGetDeviceProcAddr);
|
||||
LOAD_FUNCPTR(vkGetInstanceProcAddr);
|
||||
LOAD_FUNCPTR(vkGetPhysicalDeviceWaylandPresentationSupportKHR);
|
||||
LOAD_FUNCPTR(vkGetSwapchainImagesKHR);
|
||||
LOAD_FUNCPTR(vkQueuePresentKHR);
|
||||
#undef LOAD_FUNCPTR
|
||||
|
||||
return NULL;
|
||||
*driver_funcs = vulkan_funcs;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#else /* No vulkan */
|
||||
|
||||
const struct vulkan_funcs *WAYLAND_wine_get_vulkan_driver(UINT version)
|
||||
UINT WAYLAND_VulkanInit(UINT version, void *vulkan_handle, struct vulkan_funcs *driver_funcs)
|
||||
{
|
||||
ERR("Wine was built without Vulkan support.\n");
|
||||
return NULL;
|
||||
ERR( "Wine was built without Vulkan support.\n" );
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
#endif /* SONAME_LIBVULKAN */
|
||||
|
|
|
@ -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);
|
||||
const struct vulkan_funcs *WAYLAND_wine_get_vulkan_driver(UINT version);
|
||||
UINT WAYLAND_VulkanInit(UINT version, void *vulkan_handle, struct vulkan_funcs *driver_funcs);
|
||||
struct opengl_funcs *WAYLAND_wine_get_wgl_driver(UINT version);
|
||||
|
||||
#endif /* __WINE_WAYLANDDRV_H */
|
||||
|
|
|
@ -42,7 +42,7 @@ static const struct user_driver_funcs waylanddrv_funcs =
|
|||
.pWindowMessage = WAYLAND_WindowMessage,
|
||||
.pWindowPosChanged = WAYLAND_WindowPosChanged,
|
||||
.pWindowPosChanging = WAYLAND_WindowPosChanging,
|
||||
.pwine_get_vulkan_driver = WAYLAND_wine_get_vulkan_driver,
|
||||
.pVulkanInit = WAYLAND_VulkanInit,
|
||||
.pwine_get_wgl_driver = WAYLAND_wine_get_wgl_driver,
|
||||
};
|
||||
|
||||
|
|
|
@ -333,14 +333,6 @@ static struct opengl_funcs *X11DRV_wine_get_wgl_driver( UINT version )
|
|||
return get_glx_driver( version );
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* X11DRV_wine_get_vulkan_driver
|
||||
*/
|
||||
static const struct vulkan_funcs *X11DRV_wine_get_vulkan_driver( UINT version )
|
||||
{
|
||||
return get_vulkan_driver( version );
|
||||
}
|
||||
|
||||
|
||||
static const struct user_driver_funcs x11drv_funcs =
|
||||
{
|
||||
|
@ -436,7 +428,7 @@ static const struct user_driver_funcs x11drv_funcs =
|
|||
.pWindowPosChanging = X11DRV_WindowPosChanging,
|
||||
.pWindowPosChanged = X11DRV_WindowPosChanged,
|
||||
.pSystemParametersInfo = X11DRV_SystemParametersInfo,
|
||||
.pwine_get_vulkan_driver = X11DRV_wine_get_vulkan_driver,
|
||||
.pVulkanInit = X11DRV_VulkanInit,
|
||||
.pwine_get_wgl_driver = X11DRV_wine_get_wgl_driver,
|
||||
.pThreadDetach = X11DRV_ThreadDetach,
|
||||
};
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#include <stdio.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "ntstatus.h"
|
||||
#define WIN32_NO_STATUS
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
|
||||
|
@ -94,43 +96,6 @@ static inline struct wine_vk_surface *surface_from_handle(VkSurfaceKHR handle)
|
|||
return (struct wine_vk_surface *)(uintptr_t)handle;
|
||||
}
|
||||
|
||||
static void *vulkan_handle;
|
||||
|
||||
static void wine_vk_init(void)
|
||||
{
|
||||
init_recursive_mutex(&vulkan_mutex);
|
||||
|
||||
if (!(vulkan_handle = dlopen(SONAME_LIBVULKAN, RTLD_NOW)))
|
||||
{
|
||||
ERR("Failed to load %s.\n", SONAME_LIBVULKAN);
|
||||
return;
|
||||
}
|
||||
|
||||
#define LOAD_FUNCPTR(f) if (!(p##f = dlsym(vulkan_handle, #f))) goto fail
|
||||
#define LOAD_OPTIONAL_FUNCPTR(f) p##f = dlsym(vulkan_handle, #f)
|
||||
LOAD_FUNCPTR(vkCreateInstance);
|
||||
LOAD_FUNCPTR(vkCreateSwapchainKHR);
|
||||
LOAD_FUNCPTR(vkCreateXlibSurfaceKHR);
|
||||
LOAD_FUNCPTR(vkDestroyInstance);
|
||||
LOAD_FUNCPTR(vkDestroySurfaceKHR);
|
||||
LOAD_FUNCPTR(vkDestroySwapchainKHR);
|
||||
LOAD_FUNCPTR(vkEnumerateInstanceExtensionProperties);
|
||||
LOAD_FUNCPTR(vkGetDeviceProcAddr);
|
||||
LOAD_FUNCPTR(vkGetInstanceProcAddr);
|
||||
LOAD_FUNCPTR(vkGetPhysicalDeviceXlibPresentationSupportKHR);
|
||||
LOAD_FUNCPTR(vkGetSwapchainImagesKHR);
|
||||
LOAD_FUNCPTR(vkQueuePresentKHR);
|
||||
#undef LOAD_FUNCPTR
|
||||
#undef LOAD_OPTIONAL_FUNCPTR
|
||||
|
||||
vulkan_hwnd_context = XUniqueContext();
|
||||
return;
|
||||
|
||||
fail:
|
||||
dlclose(vulkan_handle);
|
||||
vulkan_handle = NULL;
|
||||
}
|
||||
|
||||
/* Helper function for converting between win32 and X11 compatible VkInstanceCreateInfo.
|
||||
* Caller is responsible for allocation and cleanup of 'dst'.
|
||||
*/
|
||||
|
@ -526,29 +491,42 @@ static const struct vulkan_funcs vulkan_funcs =
|
|||
X11DRV_wine_get_host_surface,
|
||||
};
|
||||
|
||||
const struct vulkan_funcs *get_vulkan_driver(UINT version)
|
||||
UINT X11DRV_VulkanInit( UINT version, void *vulkan_handle, struct vulkan_funcs *driver_funcs )
|
||||
{
|
||||
static pthread_once_t init_once = PTHREAD_ONCE_INIT;
|
||||
|
||||
if (version != WINE_VULKAN_DRIVER_VERSION)
|
||||
{
|
||||
ERR("version mismatch, vulkan wants %u but driver has %u\n", version, WINE_VULKAN_DRIVER_VERSION);
|
||||
return NULL;
|
||||
ERR( "version mismatch, win32u wants %u but driver has %u\n", version, WINE_VULKAN_DRIVER_VERSION );
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
pthread_once(&init_once, wine_vk_init);
|
||||
if (vulkan_handle)
|
||||
return &vulkan_funcs;
|
||||
init_recursive_mutex( &vulkan_mutex );
|
||||
|
||||
return NULL;
|
||||
#define LOAD_FUNCPTR( f ) if (!(p##f = dlsym( vulkan_handle, #f ))) return STATUS_PROCEDURE_NOT_FOUND;
|
||||
LOAD_FUNCPTR( vkCreateInstance );
|
||||
LOAD_FUNCPTR( vkCreateSwapchainKHR );
|
||||
LOAD_FUNCPTR( vkCreateXlibSurfaceKHR );
|
||||
LOAD_FUNCPTR( vkDestroyInstance );
|
||||
LOAD_FUNCPTR( vkDestroySurfaceKHR );
|
||||
LOAD_FUNCPTR( vkDestroySwapchainKHR );
|
||||
LOAD_FUNCPTR( vkEnumerateInstanceExtensionProperties );
|
||||
LOAD_FUNCPTR( vkGetDeviceProcAddr );
|
||||
LOAD_FUNCPTR( vkGetInstanceProcAddr );
|
||||
LOAD_FUNCPTR( vkGetPhysicalDeviceXlibPresentationSupportKHR );
|
||||
LOAD_FUNCPTR( vkGetSwapchainImagesKHR );
|
||||
LOAD_FUNCPTR( vkQueuePresentKHR );
|
||||
#undef LOAD_FUNCPTR
|
||||
|
||||
vulkan_hwnd_context = XUniqueContext();
|
||||
*driver_funcs = vulkan_funcs;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#else /* No vulkan */
|
||||
|
||||
const struct vulkan_funcs *get_vulkan_driver(UINT version)
|
||||
UINT X11DRV_VulkanInit( UINT version, void *vulkan_handle, struct vulkan_funcs *driver_funcs )
|
||||
{
|
||||
ERR("Wine was built without Vulkan support.\n");
|
||||
return NULL;
|
||||
ERR( "Wine was built without Vulkan support.\n" );
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
void wine_vk_surface_destroy(HWND hwnd)
|
||||
|
|
|
@ -292,7 +292,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 const struct vulkan_funcs *get_vulkan_driver(UINT);
|
||||
extern UINT X11DRV_VulkanInit( UINT, void *, struct vulkan_funcs * );
|
||||
|
||||
extern struct format_entry *import_xdnd_selection( Display *display, Window win, Atom selection,
|
||||
Atom *targets, UINT count,
|
||||
|
|
|
@ -819,7 +819,7 @@ BOOL X11DRV_SystemParametersInfo( UINT action, UINT int_param, void *ptr_param,
|
|||
|
||||
NTSTATUS X11DRV_D3DKMTCloseAdapter( const D3DKMT_CLOSEADAPTER *desc )
|
||||
{
|
||||
const struct vulkan_funcs *vulkan_funcs = get_vulkan_driver(WINE_VULKAN_DRIVER_VERSION);
|
||||
const struct vulkan_funcs *vulkan_funcs = __wine_get_vulkan_driver( WINE_VULKAN_DRIVER_VERSION );
|
||||
struct x11_d3dkmt_adapter *adapter;
|
||||
|
||||
if (!vulkan_funcs)
|
||||
|
@ -1003,7 +1003,7 @@ NTSTATUS X11DRV_D3DKMTOpenAdapterFromLuid( D3DKMT_OPENADAPTERFROMLUID *desc )
|
|||
}
|
||||
|
||||
/* Find the Vulkan device with corresponding UUID */
|
||||
if (!(vulkan_funcs = get_vulkan_driver(WINE_VULKAN_DRIVER_VERSION)))
|
||||
if (!(vulkan_funcs = __wine_get_vulkan_driver( WINE_VULKAN_DRIVER_VERSION )))
|
||||
{
|
||||
WARN("Vulkan is unavailable.\n");
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
|
@ -1091,7 +1091,7 @@ done:
|
|||
|
||||
NTSTATUS X11DRV_D3DKMTQueryVideoMemoryInfo( D3DKMT_QUERYVIDEOMEMORYINFO *desc )
|
||||
{
|
||||
const struct vulkan_funcs *vulkan_funcs = get_vulkan_driver(WINE_VULKAN_DRIVER_VERSION);
|
||||
const struct vulkan_funcs *vulkan_funcs = __wine_get_vulkan_driver( WINE_VULKAN_DRIVER_VERSION );
|
||||
PFN_vkGetPhysicalDeviceMemoryProperties2KHR pvkGetPhysicalDeviceMemoryProperties2KHR;
|
||||
VkPhysicalDeviceMemoryBudgetPropertiesEXT budget;
|
||||
VkPhysicalDeviceMemoryProperties2 properties2;
|
||||
|
|
|
@ -639,7 +639,7 @@ static BOOL get_gpu_properties_from_vulkan( struct gdi_gpu *gpu, const XRRProvid
|
|||
"VK_KHR_display",
|
||||
VK_KHR_SURFACE_EXTENSION_NAME,
|
||||
};
|
||||
const struct vulkan_funcs *vulkan_funcs = get_vulkan_driver( WINE_VULKAN_DRIVER_VERSION );
|
||||
const struct vulkan_funcs *vulkan_funcs = __wine_get_vulkan_driver( WINE_VULKAN_DRIVER_VERSION );
|
||||
VkResult (*pvkGetRandROutputDisplayEXT)( VkPhysicalDevice, Display *, RROutput, VkDisplayKHR * );
|
||||
PFN_vkGetPhysicalDeviceProperties2KHR pvkGetPhysicalDeviceProperties2KHR;
|
||||
PFN_vkEnumeratePhysicalDevices pvkEnumeratePhysicalDevices;
|
||||
|
|
|
@ -175,7 +175,7 @@ struct gdi_dc_funcs
|
|||
};
|
||||
|
||||
/* increment this when you change the DC function table */
|
||||
#define WINE_GDI_DRIVER_VERSION 84
|
||||
#define WINE_GDI_DRIVER_VERSION 85
|
||||
|
||||
#define GDI_PRIORITY_NULL_DRV 0 /* null driver */
|
||||
#define GDI_PRIORITY_FONT_DRV 100 /* any font driver */
|
||||
|
@ -348,7 +348,7 @@ struct user_driver_funcs
|
|||
/* system parameters */
|
||||
BOOL (*pSystemParametersInfo)(UINT,UINT,void*,UINT);
|
||||
/* vulkan support */
|
||||
const struct vulkan_funcs * (*pwine_get_vulkan_driver)(UINT);
|
||||
UINT (*pVulkanInit)(UINT,void *,struct vulkan_funcs *);
|
||||
/* opengl support */
|
||||
struct opengl_funcs * (*pwine_get_wgl_driver)(UINT);
|
||||
/* thread management */
|
||||
|
|
Loading…
Add table
Reference in a new issue