Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
28873ce8
Commit
28873ce8
authored
Feb 12, 2024
by
Rémi Bernon
Committed by
Alexandre Julliard
Mar 22, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32u: Move vulkan loading and init guard out of the drivers.
parent
1ddaa1d3
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
150 additions
and
170 deletions
+150
-170
driver.c
dlls/win32u/driver.c
+6
-6
vulkan.c
dlls/win32u/vulkan.c
+57
-1
gdi.c
dlls/winemac.drv/gdi.c
+1
-1
macdrv.h
dlls/winemac.drv/macdrv.h
+1
-1
vulkan.c
dlls/winemac.drv/vulkan.c
+23
-48
vulkan.c
dlls/winewayland.drv/vulkan.c
+25
-46
waylanddrv.h
dlls/winewayland.drv/waylanddrv.h
+1
-1
waylanddrv_main.c
dlls/winewayland.drv/waylanddrv_main.c
+1
-1
init.c
dlls/winex11.drv/init.c
+1
-9
vulkan.c
dlls/winex11.drv/vulkan.c
+27
-49
x11drv.h
dlls/winex11.drv/x11drv.h
+1
-1
x11drv_main.c
dlls/winex11.drv/x11drv_main.c
+3
-3
xrandr.c
dlls/winex11.drv/xrandr.c
+1
-1
gdi_driver.h
include/wine/gdi_driver.h
+2
-2
No files found.
dlls/win32u/driver.c
View file @
28873ce8
...
...
@@ -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
()
->
p
wine_get_vulkan_driver
(
version
);
return
load_driver
()
->
p
VulkanInit
(
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
...
...
dlls/win32u/vulkan.c
View file @
28873ce8
...
...
@@ -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 */
dlls/winemac.drv/gdi.c
View file @
28873ce8
...
...
@@ -308,7 +308,7 @@ static const struct user_driver_funcs macdrv_funcs =
.
pWindowMessage
=
macdrv_WindowMessage
,
.
pWindowPosChanged
=
macdrv_WindowPosChanged
,
.
pWindowPosChanging
=
macdrv_WindowPosChanging
,
.
p
wine_get_vulkan_driver
=
macdrv_wine_get_vulkan_driver
,
.
p
VulkanInit
=
macdrv_VulkanInit
,
.
pwine_get_wgl_driver
=
macdrv_wine_get_wgl_driver
,
};
...
...
dlls/winemac.drv/macdrv.h
View file @
28873ce8
...
...
@@ -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
,
...
...
dlls/winemac.drv/vulkan.c
View file @
28873ce8
...
...
@@ -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
);
}
dlls/winewayland.drv/vulkan.c
View file @
28873ce8
...
...
@@ -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 */
dlls/winewayland.drv/waylanddrv.h
View file @
28873ce8
...
...
@@ -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 */
dlls/winewayland.drv/waylanddrv_main.c
View file @
28873ce8
...
...
@@ -42,7 +42,7 @@ static const struct user_driver_funcs waylanddrv_funcs =
.
pWindowMessage
=
WAYLAND_WindowMessage
,
.
pWindowPosChanged
=
WAYLAND_WindowPosChanged
,
.
pWindowPosChanging
=
WAYLAND_WindowPosChanging
,
.
p
wine_get_vulkan_driver
=
WAYLAND_wine_get_vulkan_driver
,
.
p
VulkanInit
=
WAYLAND_VulkanInit
,
.
pwine_get_wgl_driver
=
WAYLAND_wine_get_wgl_driver
,
};
...
...
dlls/winex11.drv/init.c
View file @
28873ce8
...
...
@@ -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
,
.
p
wine_get_vulkan_driver
=
X11DRV_wine_get_vulkan_driver
,
.
p
VulkanInit
=
X11DRV_VulkanInit
,
.
pwine_get_wgl_driver
=
X11DRV_wine_get_wgl_driver
,
.
pThreadDetach
=
X11DRV_ThreadDetach
,
};
...
...
dlls/winex11.drv/vulkan.c
View file @
28873ce8
...
...
@@ -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
);
#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
return
NULL
;
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
)
...
...
dlls/winex11.drv/x11drv.h
View file @
28873ce8
...
...
@@ -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
,
...
...
dlls/winex11.drv/x11drv_main.c
View file @
28873ce8
...
...
@@ -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
;
...
...
dlls/winex11.drv/xrandr.c
View file @
28873ce8
...
...
@@ -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
;
...
...
include/wine/gdi_driver.h
View file @
28873ce8
...
...
@@ -175,7 +175,7 @@ struct gdi_dc_funcs
};
/* increment this when you change the DC function table */
#define WINE_GDI_DRIVER_VERSION 8
4
#define WINE_GDI_DRIVER_VERSION 8
5
#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 */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment