Commit 9596e7f2 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Use user driver for wine_get_vulkan_driver.

parent 316a358b
......@@ -72,12 +72,8 @@ static PFN_vkGetInstanceProcAddr load_vulkan(void)
static PFN_vkGetInstanceProcAddr load_vulkan(void)
{
const struct vulkan_funcs *vk_funcs;
HDC hdc;
hdc = GetDC(0);
vk_funcs = __wine_get_vulkan_driver(hdc, WINE_VULKAN_DRIVER_VERSION);
ReleaseDC(0, hdc);
vk_funcs = __wine_get_vulkan_driver(WINE_VULKAN_DRIVER_VERSION);
if (vk_funcs)
return (PFN_vkGetInstanceProcAddr)vk_funcs->p_vkGetInstanceProcAddr;
......
......@@ -975,14 +975,10 @@ static void close_library(void *handle)
static PFN_vkGetInstanceProcAddr load_vulkan(void **vulkan_handle)
{
const struct vulkan_funcs *vk_funcs;
HDC hdc;
*vulkan_handle = NULL;
hdc = GetDC(0);
vk_funcs = __wine_get_vulkan_driver(hdc, WINE_VULKAN_DRIVER_VERSION);
ReleaseDC(0, hdc);
vk_funcs = __wine_get_vulkan_driver(WINE_VULKAN_DRIVER_VERSION);
if (vk_funcs)
return (PFN_vkGetInstanceProcAddr)vk_funcs->p_vkGetInstanceProcAddr;
......
......@@ -414,6 +414,8 @@ static struct user_driver_funcs lazy_load_driver =
nulldrv_WindowPosChanged,
/* system parameters */
NULL,
/* vulkan support */
NULL,
/* thread management */
nulldrv_ThreadDetach
};
......
......@@ -716,7 +716,6 @@ const struct gdi_dc_funcs dib_driver =
NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */
NULL, /* pD3DKMTSetVidPnSourceOwner */
dibdrv_wine_get_wgl_driver, /* wine_get_wgl_driver */
NULL, /* wine_get_vulkan_driver */
GDI_PRIORITY_DIB_DRV /* priority */
};
......@@ -1279,6 +1278,5 @@ static const struct gdi_dc_funcs window_driver =
NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */
NULL, /* pD3DKMTSetVidPnSourceOwner */
windrv_wine_get_wgl_driver, /* wine_get_wgl_driver */
NULL, /* wine_get_vulkan_driver */
GDI_PRIORITY_DIB_DRV + 10 /* priority */
};
......@@ -584,11 +584,6 @@ static struct opengl_funcs * CDECL nulldrv_wine_get_wgl_driver( PHYSDEV dev, UIN
return (void *)-1;
}
static const struct vulkan_funcs * CDECL nulldrv_wine_get_vulkan_driver( PHYSDEV dev, UINT version )
{
return NULL;
}
const struct gdi_dc_funcs null_driver =
{
nulldrv_AbortDoc, /* pAbortDoc */
......@@ -683,7 +678,6 @@ const struct gdi_dc_funcs null_driver =
nulldrv_D3DKMTCheckVidPnExclusiveOwnership, /* pD3DKMTCheckVidPnExclusiveOwnership */
nulldrv_D3DKMTSetVidPnSourceOwner, /* pD3DKMTSetVidPnSourceOwner */
nulldrv_wine_get_wgl_driver, /* wine_get_wgl_driver */
nulldrv_wine_get_vulkan_driver, /* wine_get_vulkan_driver */
GDI_PRIORITY_NULL_DRV /* priority */
};
......@@ -936,6 +930,11 @@ static BOOL CDECL nulldrv_SystemParametersInfo( UINT action, UINT int_param, voi
return FALSE;
}
static const struct vulkan_funcs * CDECL nulldrv_wine_get_vulkan_driver( UINT version )
{
return NULL;
}
static void CDECL nulldrv_ThreadDetach( void )
{
}
......@@ -1016,6 +1015,11 @@ static void CDECL loaderdrv_UpdateDisplayDevices( const struct gdi_device_manage
load_driver()->pUpdateDisplayDevices( manager, force, param );
}
static const struct vulkan_funcs * CDECL loaderdrv_wine_get_vulkan_driver( UINT version )
{
return load_driver()->pwine_get_vulkan_driver( version );
}
static const struct user_driver_funcs lazy_load_driver =
{
.pActivateKeyboardLayout = loaderdrv_ActivateKeyboardLayout,
......@@ -1032,6 +1036,7 @@ static const struct user_driver_funcs lazy_load_driver =
.pUpdateClipboard = loaderdrv_UpdateClipboard,
.pScrollDC = nulldrv_ScrollDC,
.pSystemParametersInfo = nulldrv_SystemParametersInfo,
.pwine_get_vulkan_driver = loaderdrv_wine_get_vulkan_driver,
};
const struct user_driver_funcs *user_driver = &lazy_load_driver;
......@@ -1092,6 +1097,7 @@ void CDECL __wine_set_display_driver( struct user_driver_funcs *driver, UINT ver
SET_USER_FUNC(WindowPosChanging);
SET_USER_FUNC(WindowPosChanged);
SET_USER_FUNC(SystemParametersInfo);
SET_USER_FUNC(wine_get_vulkan_driver);
SET_USER_FUNC(ThreadDetach);
#undef SET_USER_FUNC
......
......@@ -525,7 +525,6 @@ static const struct gdi_dc_funcs emfdrv_driver =
NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */
NULL, /* pD3DKMTSetVidPnSourceOwner */
NULL, /* wine_get_wgl_driver */
NULL, /* wine_get_vulkan_driver */
GDI_PRIORITY_GRAPHICS_DRV /* priority */
};
......
......@@ -4352,7 +4352,6 @@ const struct gdi_dc_funcs font_driver =
NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */
NULL, /* pD3DKMTSetVidPnSourceOwner */
NULL, /* wine_get_wgl_driver */
NULL, /* wine_get_vulkan_driver */
GDI_PRIORITY_FONT_DRV /* priority */
};
......
......@@ -2120,6 +2120,5 @@ const struct gdi_dc_funcs path_driver =
NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */
NULL, /* pD3DKMTSetVidPnSourceOwner */
NULL, /* wine_get_wgl_driver */
NULL, /* wine_get_vulkan_driver */
GDI_PRIORITY_PATH_DRV /* priority */
};
......@@ -25,18 +25,9 @@
#include "ntgdi_private.h"
/***********************************************************************
* __wine_get_vulkan_driver (GDI32.@)
* __wine_get_vulkan_driver (win32u.@)
*/
const struct vulkan_funcs * CDECL __wine_get_vulkan_driver(HDC hdc, UINT version)
const struct vulkan_funcs * CDECL __wine_get_vulkan_driver( UINT version )
{
const struct vulkan_funcs *ret = NULL;
DC *dc = get_dc_ptr(hdc);
if (dc)
{
PHYSDEV physdev = GET_DC_PHYSDEV(dc, wine_get_vulkan_driver);
ret = physdev->funcs->wine_get_vulkan_driver(physdev, version);
release_dc_ptr(dc);
}
return ret;
return user_driver->pwine_get_vulkan_driver( version );
}
......@@ -1333,7 +1333,7 @@
@ cdecl __wine_get_wgl_driver(long long)
# Vulkan
@ cdecl __wine_get_vulkan_driver(long long)
@ cdecl __wine_get_vulkan_driver(long)
# gdi32
@ stdcall SetDIBits(long long long long ptr ptr long)
......
......@@ -233,7 +233,7 @@ struct unix_funcs
BOOL (CDECL *get_brush_bitmap_info)( HBRUSH handle, BITMAPINFO *info, void *bits, UINT *usage );
BOOL (CDECL *get_file_outline_text_metric)( const WCHAR *path, OUTLINETEXTMETRICW *otm );
BOOL (CDECL *get_icm_profile)( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename );
const struct vulkan_funcs * (CDECL *get_vulkan_driver)( HDC hdc, UINT version );
const struct vulkan_funcs * (CDECL *get_vulkan_driver)( UINT version );
struct opengl_funcs * (CDECL *get_wgl_driver)( HDC hdc, UINT version );
void (CDECL *set_display_driver)( struct user_driver_funcs *funcs, UINT version );
void (CDECL *set_visible_region)( HDC hdc, HRGN hrgn, const RECT *vis_rect, const RECT *device_rect,
......
......@@ -896,10 +896,10 @@ BOOL CDECL __wine_get_file_outline_text_metric( const WCHAR *path, OUTLINETEXTME
return unix_funcs->get_file_outline_text_metric( path, otm );
}
const struct vulkan_funcs * CDECL __wine_get_vulkan_driver(HDC hdc, UINT version)
const struct vulkan_funcs * CDECL __wine_get_vulkan_driver(UINT version)
{
if (!unix_funcs) return NULL;
return unix_funcs->get_vulkan_driver( hdc, version );
return unix_funcs->get_vulkan_driver( version );
}
struct opengl_funcs * CDECL __wine_get_wgl_driver( HDC hdc, UINT version )
......
......@@ -250,11 +250,8 @@ static BOOL wined3d_load_vulkan(struct wined3d_vk_info *vk_info)
{
struct vulkan_ops *vk_ops = &vk_info->vk_ops;
const struct vulkan_funcs *vk_funcs;
HDC dc;
dc = GetDC(0);
vk_funcs = __wine_get_vulkan_driver(dc, WINE_VULKAN_DRIVER_VERSION);
ReleaseDC(0, dc);
vk_funcs = __wine_get_vulkan_driver(WINE_VULKAN_DRIVER_VERSION);
if (!vk_funcs)
return FALSE;
......
......@@ -269,7 +269,6 @@ static const struct user_driver_funcs macdrv_funcs =
.dc_funcs.pGetDeviceGammaRamp = macdrv_GetDeviceGammaRamp,
.dc_funcs.pSetDeviceGammaRamp = macdrv_SetDeviceGammaRamp,
.dc_funcs.wine_get_wgl_driver = macdrv_wine_get_wgl_driver,
.dc_funcs.wine_get_vulkan_driver = macdrv_wine_get_vulkan_driver,
.dc_funcs.priority = GDI_PRIORITY_GRAPHICS_DRV,
.pActivateKeyboardLayout = macdrv_ActivateKeyboardLayout,
......@@ -309,6 +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,
};
......
......@@ -264,7 +264,7 @@ extern BOOL query_drag_exited(macdrv_query* query) DECLSPEC_HIDDEN;
extern BOOL query_drag_drop(macdrv_query* query) DECLSPEC_HIDDEN;
extern struct opengl_funcs * CDECL macdrv_wine_get_wgl_driver(PHYSDEV dev, UINT version) DECLSPEC_HIDDEN;
extern const struct vulkan_funcs * CDECL macdrv_wine_get_vulkan_driver(PHYSDEV dev, UINT version) DECLSPEC_HIDDEN;
extern const struct vulkan_funcs * CDECL macdrv_wine_get_vulkan_driver(UINT version) DECLSPEC_HIDDEN;
extern void sync_gl_view(struct macdrv_win_data* data, const RECT* old_whole_rect, const RECT* old_client_rect) DECLSPEC_HIDDEN;
extern CGImageRef create_cgimage_from_icon_bitmaps(HDC hdc, HANDLE icon, HBITMAP hbmColor,
......
......@@ -650,14 +650,7 @@ static const struct vulkan_funcs *get_vulkan_driver(UINT version)
#endif /* SONAME_LIBMOLTENVK */
const struct vulkan_funcs * CDECL macdrv_wine_get_vulkan_driver(PHYSDEV dev, UINT version)
const struct vulkan_funcs * CDECL macdrv_wine_get_vulkan_driver(UINT version)
{
const struct vulkan_funcs *ret;
if (!(ret = get_vulkan_driver( version )))
{
dev = GET_NEXT_PHYSDEV( dev, wine_get_vulkan_driver );
ret = dev->funcs->wine_get_vulkan_driver( dev, version );
}
return ret;
return get_vulkan_driver( version );
}
......@@ -859,7 +859,6 @@ static const struct gdi_dc_funcs psdrv_funcs =
NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */
NULL, /* pD3DKMTSetVidPnSourceOwner */
NULL, /* wine_get_wgl_driver */
NULL, /* wine_get_vulkan_driver */
GDI_PRIORITY_GRAPHICS_DRV /* priority */
};
......
......@@ -221,11 +221,8 @@ VkResult WINAPI vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t *supported_ver
static BOOL WINAPI wine_vk_init(INIT_ONCE *once, void *param, void **context)
{
const struct vulkan_funcs *driver;
HDC hdc;
hdc = GetDC(0);
driver = __wine_get_vulkan_driver(hdc, WINE_VULKAN_DRIVER_VERSION);
ReleaseDC(0, hdc);
driver = __wine_get_vulkan_driver(WINE_VULKAN_DRIVER_VERSION);
if (!driver)
ERR("Failed to load Wine graphics driver supporting Vulkan.\n");
......
......@@ -3124,7 +3124,7 @@ class VkGenerator(object):
f.write(" VkSurfaceKHR (*p_wine_get_native_surface)(VkSurfaceKHR);\n")
f.write("};\n\n")
f.write("extern const struct vulkan_funcs * CDECL __wine_get_vulkan_driver(HDC hdc, UINT version);\n\n")
f.write("extern const struct vulkan_funcs * CDECL __wine_get_vulkan_driver(UINT version);\n\n")
f.write("static inline void *get_vulkan_driver_device_proc_addr(\n")
f.write(" const struct vulkan_funcs *vulkan_funcs, const char *name)\n{\n")
......
......@@ -327,16 +327,9 @@ static struct opengl_funcs * CDECL X11DRV_wine_get_wgl_driver( PHYSDEV dev, UINT
/**********************************************************************
* X11DRV_wine_get_vulkan_driver
*/
static const struct vulkan_funcs * CDECL X11DRV_wine_get_vulkan_driver( PHYSDEV dev, UINT version )
static const struct vulkan_funcs * CDECL X11DRV_wine_get_vulkan_driver( UINT version )
{
const struct vulkan_funcs *ret;
if (!(ret = get_vulkan_driver( version )))
{
dev = GET_NEXT_PHYSDEV( dev, wine_get_vulkan_driver );
ret = dev->funcs->wine_get_vulkan_driver( dev, version );
}
return ret;
return get_vulkan_driver( version );
}
......@@ -385,7 +378,6 @@ static const struct user_driver_funcs x11drv_funcs =
.dc_funcs.pD3DKMTCheckVidPnExclusiveOwnership = X11DRV_D3DKMTCheckVidPnExclusiveOwnership,
.dc_funcs.pD3DKMTSetVidPnSourceOwner = X11DRV_D3DKMTSetVidPnSourceOwner,
.dc_funcs.wine_get_wgl_driver = X11DRV_wine_get_wgl_driver,
.dc_funcs.wine_get_vulkan_driver = X11DRV_wine_get_vulkan_driver,
.dc_funcs.priority = GDI_PRIORITY_GRAPHICS_DRV,
.pActivateKeyboardLayout = X11DRV_ActivateKeyboardLayout,
......@@ -426,6 +418,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,
.pThreadDetach = X11DRV_ThreadDetach,
};
......
......@@ -2247,7 +2247,6 @@ static const struct gdi_dc_funcs xrender_funcs =
NULL, /* pD3DKMTCheckVidPnExclusiveOwnership */
NULL, /* pD3DKMTSetVidPnSourceOwner */
NULL, /* wine_get_wgl_driver */
NULL, /* wine_get_vulkan_driver */
GDI_PRIORITY_GRAPHICS_DRV + 10 /* priority */
};
......
......@@ -160,14 +160,13 @@ struct gdi_dc_funcs
NTSTATUS (CDECL *pD3DKMTCheckVidPnExclusiveOwnership)(const D3DKMT_CHECKVIDPNEXCLUSIVEOWNERSHIP *);
NTSTATUS (CDECL *pD3DKMTSetVidPnSourceOwner)(const D3DKMT_SETVIDPNSOURCEOWNER *);
struct opengl_funcs * (CDECL *wine_get_wgl_driver)(PHYSDEV,UINT);
const struct vulkan_funcs * (CDECL *wine_get_vulkan_driver)(PHYSDEV,UINT);
/* priority order for the driver on the stack */
UINT priority;
};
/* increment this when you change the DC function table */
#define WINE_GDI_DRIVER_VERSION 73
#define WINE_GDI_DRIVER_VERSION 74
#define GDI_PRIORITY_NULL_DRV 0 /* null driver */
#define GDI_PRIORITY_FONT_DRV 100 /* any font driver */
......@@ -320,6 +319,8 @@ struct user_driver_funcs
const RECT *,struct window_surface*);
/* system parameters */
BOOL (CDECL *pSystemParametersInfo)(UINT,UINT,void*,UINT);
/* vulkan support */
const struct vulkan_funcs * (CDECL *pwine_get_vulkan_driver)(UINT);
/* thread management */
void (CDECL *pThreadDetach)(void);
};
......@@ -346,6 +347,6 @@ extern void CDECL __wine_set_visible_region( HDC hdc, HRGN hrgn, const RECT *vis
const RECT *device_rect, struct window_surface *surface );
extern void CDECL __wine_set_display_driver( struct user_driver_funcs *funcs, UINT version );
extern struct opengl_funcs * CDECL __wine_get_wgl_driver( HDC hdc, UINT version );
extern const struct vulkan_funcs * CDECL __wine_get_vulkan_driver( HDC hdc, UINT version );
extern const struct vulkan_funcs * CDECL __wine_get_vulkan_driver( UINT version );
#endif /* __WINE_WINE_GDI_DRIVER_H */
......@@ -46,7 +46,7 @@ struct vulkan_funcs
VkSurfaceKHR (*p_wine_get_native_surface)(VkSurfaceKHR);
};
extern const struct vulkan_funcs * CDECL __wine_get_vulkan_driver(HDC hdc, UINT version);
extern const struct vulkan_funcs * CDECL __wine_get_vulkan_driver(UINT version);
static inline void *get_vulkan_driver_device_proc_addr(
const struct vulkan_funcs *vulkan_funcs, const char *name)
......
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