From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/driver.c | 29 +++++++++++++++++++++++++++++ dlls/win32u/opengl.c | 6 +++++- dlls/win32u/vulkan.c | 28 +--------------------------- dlls/win32u/win32u_private.h | 2 ++ 4 files changed, 37 insertions(+), 28 deletions(-)
diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index cf3be4be949..386100c0e36 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c @@ -1428,3 +1428,32 @@ INT WINAPI NtGdiExtEscape( HDC hdc, WCHAR *driver, int driver_id, INT escape, IN release_dc_ptr( dc ); return ret; } + +static void nulldrv_surface_destroy( struct client_surface *client ) +{ +} + +static void nulldrv_surface_detach( struct client_surface *client ) +{ +} + +static void nulldrv_surface_update( struct client_surface *client ) +{ +} + +static void nulldrv_surface_present( struct client_surface *client, HDC hdc ) +{ +} + +static const struct client_surface_funcs nulldrv_surface_funcs = +{ + .destroy = nulldrv_surface_destroy, + .detach = nulldrv_surface_detach, + .update = nulldrv_surface_update, + .present = nulldrv_surface_present, +}; + +struct client_surface *nulldrv_client_surface_create( HWND hwnd ) +{ + return client_surface_create( sizeof(struct client_surface), &nulldrv_surface_funcs, hwnd ); +} diff --git a/dlls/win32u/opengl.c b/dlls/win32u/opengl.c index eea6c3f3ec5..4b7fa14c6a9 100644 --- a/dlls/win32u/opengl.c +++ b/dlls/win32u/opengl.c @@ -389,7 +389,11 @@ static const char *egldrv_init_wgl_extensions( struct opengl_funcs *funcs )
static BOOL egldrv_surface_create( HWND hwnd, HDC hdc, int format, struct opengl_drawable **drawable ) { - *drawable = opengl_drawable_create( sizeof(**drawable), &egldrv_surface_funcs, format, NULL ); + struct client_surface *client; + + if (!(client = nulldrv_client_surface_create( hwnd ))) return FALSE; + *drawable = opengl_drawable_create( sizeof(**drawable), &egldrv_surface_funcs, format, client ); + client_surface_release( client ); return !!*drawable; }
diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index 722bdd845cf..0945772fb03 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -499,15 +499,13 @@ static struct vulkan_funcs vulkan_funcs = .p_get_host_surface_extension = win32u_get_host_surface_extension, };
-static const struct client_surface_funcs nulldrv_vulkan_surface_funcs; - static VkResult nulldrv_vulkan_surface_create( HWND hwnd, const struct vulkan_instance *instance, VkSurfaceKHR *surface, struct client_surface **client ) { VkHeadlessSurfaceCreateInfoEXT create_info = {.sType = VK_STRUCTURE_TYPE_HEADLESS_SURFACE_CREATE_INFO_EXT}; VkResult res;
- if (!(*client = client_surface_create(sizeof(**client), &nulldrv_vulkan_surface_funcs, hwnd))) return VK_ERROR_OUT_OF_HOST_MEMORY; + if (!(*client = nulldrv_client_surface_create( hwnd ))) return VK_ERROR_OUT_OF_HOST_MEMORY; if ((res = instance->p_vkCreateHeadlessSurfaceEXT( instance->host.instance, &create_info, NULL, surface ))) { client_surface_release(*client); @@ -517,22 +515,6 @@ static VkResult nulldrv_vulkan_surface_create( HWND hwnd, const struct vulkan_in return res; }
-static void nulldrv_vulkan_surface_destroy( struct client_surface *client ) -{ -} - -static void nulldrv_vulkan_surface_detach( struct client_surface *client ) -{ -} - -static void nulldrv_vulkan_surface_update( struct client_surface *client ) -{ -} - -static void nulldrv_vulkan_surface_present( struct client_surface *client, HDC hdc ) -{ -} - static VkBool32 nulldrv_vkGetPhysicalDeviceWin32PresentationSupportKHR( VkPhysicalDevice device, uint32_t queue ) { return VK_TRUE; @@ -543,14 +525,6 @@ static const char *nulldrv_get_host_surface_extension(void) return "VK_EXT_headless_surface"; }
-static const struct client_surface_funcs nulldrv_vulkan_surface_funcs = -{ - .destroy = nulldrv_vulkan_surface_destroy, - .detach = nulldrv_vulkan_surface_detach, - .update = nulldrv_vulkan_surface_update, - .present = nulldrv_vulkan_surface_present, -}; - static const struct vulkan_driver_funcs nulldrv_funcs = { .p_vulkan_surface_create = nulldrv_vulkan_surface_create, diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index e683f7cd824..9e7eed4584c 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -325,7 +325,9 @@ extern void reg_delete_value( HKEY hkey, const WCHAR *name );
extern HKEY hkcu_key;
+/* driver.c */ extern const struct user_driver_funcs *user_driver; +extern struct client_surface *nulldrv_client_surface_create( HWND hwnd );
extern ULONG_PTR zero_bits;