1 /* X11DRV Vulkan implementation
3 * Copyright 2017 Roderick Colenbrander
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 /* NOTE: If making changes here, consider whether they should be reflected in
21 * the other drivers. */
24 #include "wine/port.h"
32 #include "wine/debug.h"
33 #include "wine/heap.h"
34 #include "wine/library.h"
37 #define VK_NO_PROTOTYPES
40 #include "wine/vulkan.h"
41 #include "wine/vulkan_driver.h"
43 WINE_DEFAULT_DEBUG_CHANNEL(vulkan
);
45 #ifdef SONAME_LIBVULKAN
46 WINE_DECLARE_DEBUG_CHANNEL(fps
);
48 static CRITICAL_SECTION context_section
;
49 static CRITICAL_SECTION_DEBUG critsect_debug
=
51 0, 0, &context_section
,
52 { &critsect_debug
.ProcessLocksList
, &critsect_debug
.ProcessLocksList
},
53 0, 0, { (DWORD_PTR
)(__FILE__
": context_section") }
55 static CRITICAL_SECTION context_section
= { &critsect_debug
, -1, 0, 0, 0, 0 };
57 static XContext vulkan_hwnd_context
;
59 #define VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR 1000004000
61 struct wine_vk_surface
65 VkSurfaceKHR surface
; /* native surface */
68 typedef struct VkXlibSurfaceCreateInfoKHR
70 VkStructureType sType
;
72 VkXlibSurfaceCreateFlagsKHR flags
;
75 } VkXlibSurfaceCreateInfoKHR
;
77 static VkResult (*pvkCreateInstance
)(const VkInstanceCreateInfo
*, const VkAllocationCallbacks
*, VkInstance
*);
78 static VkResult (*pvkCreateSwapchainKHR
)(VkDevice
, const VkSwapchainCreateInfoKHR
*, const VkAllocationCallbacks
*, VkSwapchainKHR
*);
79 static VkResult (*pvkCreateXlibSurfaceKHR
)(VkInstance
, const VkXlibSurfaceCreateInfoKHR
*, const VkAllocationCallbacks
*, VkSurfaceKHR
*);
80 static void (*pvkDestroyInstance
)(VkInstance
, const VkAllocationCallbacks
*);
81 static void (*pvkDestroySurfaceKHR
)(VkInstance
, VkSurfaceKHR
, const VkAllocationCallbacks
*);
82 static void (*pvkDestroySwapchainKHR
)(VkDevice
, VkSwapchainKHR
, const VkAllocationCallbacks
*);
83 static VkResult (*pvkEnumerateInstanceExtensionProperties
)(const char *, uint32_t *, VkExtensionProperties
*);
84 static VkResult (*pvkGetDeviceGroupSurfacePresentModesKHR
)(VkDevice
, VkSurfaceKHR
, VkDeviceGroupPresentModeFlagsKHR
*);
85 static void * (*pvkGetDeviceProcAddr
)(VkDevice
, const char *);
86 static void * (*pvkGetInstanceProcAddr
)(VkInstance
, const char *);
87 static VkResult (*pvkGetPhysicalDevicePresentRectanglesKHR
)(VkPhysicalDevice
, VkSurfaceKHR
, uint32_t *, VkRect2D
*);
88 static VkResult (*pvkGetPhysicalDeviceSurfaceCapabilitiesKHR
)(VkPhysicalDevice
, VkSurfaceKHR
, VkSurfaceCapabilitiesKHR
*);
89 static VkResult (*pvkGetPhysicalDeviceSurfaceFormatsKHR
)(VkPhysicalDevice
, VkSurfaceKHR
, uint32_t *, VkSurfaceFormatKHR
*);
90 static VkResult (*pvkGetPhysicalDeviceSurfacePresentModesKHR
)(VkPhysicalDevice
, VkSurfaceKHR
, uint32_t *, VkPresentModeKHR
*);
91 static VkResult (*pvkGetPhysicalDeviceSurfaceSupportKHR
)(VkPhysicalDevice
, uint32_t, VkSurfaceKHR
, VkBool32
*);
92 static VkBool32 (*pvkGetPhysicalDeviceXlibPresentationSupportKHR
)(VkPhysicalDevice
, uint32_t, Display
*, VisualID
);
93 static VkResult (*pvkGetSwapchainImagesKHR
)(VkDevice
, VkSwapchainKHR
, uint32_t *, VkImage
*);
94 static VkResult (*pvkQueuePresentKHR
)(VkQueue
, const VkPresentInfoKHR
*);
96 static void *X11DRV_get_vk_device_proc_addr(const char *name
);
97 static void *X11DRV_get_vk_instance_proc_addr(VkInstance instance
, const char *name
);
99 static inline struct wine_vk_surface
*surface_from_handle(VkSurfaceKHR handle
)
101 return (struct wine_vk_surface
*)(uintptr_t)handle
;
104 static void *vulkan_handle
;
106 static BOOL WINAPI
wine_vk_init(INIT_ONCE
*once
, void *param
, void **context
)
108 if (!(vulkan_handle
= wine_dlopen(SONAME_LIBVULKAN
, RTLD_NOW
, NULL
, 0)))
110 ERR("Failed to load %s.\n", SONAME_LIBVULKAN
);
114 #define LOAD_FUNCPTR(f) if (!(p##f = wine_dlsym(vulkan_handle, #f, NULL, 0))) goto fail;
115 #define LOAD_OPTIONAL_FUNCPTR(f) p##f = wine_dlsym(vulkan_handle, #f, NULL, 0);
116 LOAD_FUNCPTR(vkCreateInstance
)
117 LOAD_FUNCPTR(vkCreateSwapchainKHR
)
118 LOAD_FUNCPTR(vkCreateXlibSurfaceKHR
)
119 LOAD_FUNCPTR(vkDestroyInstance
)
120 LOAD_FUNCPTR(vkDestroySurfaceKHR
)
121 LOAD_FUNCPTR(vkDestroySwapchainKHR
)
122 LOAD_FUNCPTR(vkEnumerateInstanceExtensionProperties
)
123 LOAD_FUNCPTR(vkGetDeviceProcAddr
)
124 LOAD_FUNCPTR(vkGetInstanceProcAddr
)
125 LOAD_FUNCPTR(vkGetPhysicalDeviceSurfaceCapabilitiesKHR
)
126 LOAD_FUNCPTR(vkGetPhysicalDeviceSurfaceFormatsKHR
)
127 LOAD_FUNCPTR(vkGetPhysicalDeviceSurfacePresentModesKHR
)
128 LOAD_FUNCPTR(vkGetPhysicalDeviceSurfaceSupportKHR
)
129 LOAD_FUNCPTR(vkGetPhysicalDeviceXlibPresentationSupportKHR
)
130 LOAD_FUNCPTR(vkGetSwapchainImagesKHR
)
131 LOAD_FUNCPTR(vkQueuePresentKHR
)
132 LOAD_OPTIONAL_FUNCPTR(vkGetDeviceGroupSurfacePresentModesKHR
)
133 LOAD_OPTIONAL_FUNCPTR(vkGetPhysicalDevicePresentRectanglesKHR
)
135 #undef LOAD_OPTIONAL_FUNCPTR
137 vulkan_hwnd_context
= XUniqueContext();
142 wine_dlclose(vulkan_handle
, NULL
, 0);
143 vulkan_handle
= NULL
;
147 /* Helper function for converting between win32 and X11 compatible VkInstanceCreateInfo.
148 * Caller is responsible for allocation and cleanup of 'dst'.
150 static VkResult
wine_vk_instance_convert_create_info(const VkInstanceCreateInfo
*src
,
151 VkInstanceCreateInfo
*dst
)
154 const char **enabled_extensions
= NULL
;
156 dst
->sType
= src
->sType
;
157 dst
->flags
= src
->flags
;
158 dst
->pApplicationInfo
= src
->pApplicationInfo
;
159 dst
->pNext
= src
->pNext
;
160 dst
->enabledLayerCount
= 0;
161 dst
->ppEnabledLayerNames
= NULL
;
162 dst
->enabledExtensionCount
= 0;
163 dst
->ppEnabledExtensionNames
= NULL
;
165 if (src
->enabledExtensionCount
> 0)
167 enabled_extensions
= heap_calloc(src
->enabledExtensionCount
, sizeof(*src
->ppEnabledExtensionNames
));
168 if (!enabled_extensions
)
170 ERR("Failed to allocate memory for enabled extensions\n");
171 return VK_ERROR_OUT_OF_HOST_MEMORY
;
174 for (i
= 0; i
< src
->enabledExtensionCount
; i
++)
176 /* Substitute extension with X11 ones else copy. Long-term, when we
177 * support more extensions, we should store these in a list.
179 if (!strcmp(src
->ppEnabledExtensionNames
[i
], "VK_KHR_win32_surface"))
181 enabled_extensions
[i
] = "VK_KHR_xlib_surface";
185 enabled_extensions
[i
] = src
->ppEnabledExtensionNames
[i
];
188 dst
->ppEnabledExtensionNames
= enabled_extensions
;
189 dst
->enabledExtensionCount
= src
->enabledExtensionCount
;
195 static struct wine_vk_surface
*wine_vk_surface_grab(struct wine_vk_surface
*surface
)
197 InterlockedIncrement(&surface
->ref
);
201 static void wine_vk_surface_release(struct wine_vk_surface
*surface
)
203 if (InterlockedDecrement(&surface
->ref
))
207 XDestroyWindow(gdi_display
, surface
->window
);
212 void wine_vk_surface_destroy(HWND hwnd
)
214 struct wine_vk_surface
*surface
;
215 EnterCriticalSection(&context_section
);
216 if (!XFindContext(gdi_display
, (XID
)hwnd
, vulkan_hwnd_context
, (char **)&surface
))
218 wine_vk_surface_release(surface
);
220 XDeleteContext(gdi_display
, (XID
)hwnd
, vulkan_hwnd_context
);
221 LeaveCriticalSection(&context_section
);
224 static VkResult
X11DRV_vkCreateInstance(const VkInstanceCreateInfo
*create_info
,
225 const VkAllocationCallbacks
*allocator
, VkInstance
*instance
)
227 VkInstanceCreateInfo create_info_host
;
229 TRACE("create_info %p, allocator %p, instance %p\n", create_info
, allocator
, instance
);
232 FIXME("Support for allocation callbacks not implemented yet\n");
234 /* Perform a second pass on converting VkInstanceCreateInfo. Winevulkan
235 * performed a first pass in which it handles everything except for WSI
236 * functionality such as VK_KHR_win32_surface. Handle this now.
238 res
= wine_vk_instance_convert_create_info(create_info
, &create_info_host
);
239 if (res
!= VK_SUCCESS
)
241 ERR("Failed to convert instance create info, res=%d\n", res
);
245 res
= pvkCreateInstance(&create_info_host
, NULL
/* allocator */, instance
);
247 heap_free((void *)create_info_host
.ppEnabledExtensionNames
);
251 static VkResult
X11DRV_vkCreateSwapchainKHR(VkDevice device
,
252 const VkSwapchainCreateInfoKHR
*create_info
,
253 const VkAllocationCallbacks
*allocator
, VkSwapchainKHR
*swapchain
)
255 VkSwapchainCreateInfoKHR create_info_host
;
256 TRACE("%p %p %p %p\n", device
, create_info
, allocator
, swapchain
);
259 FIXME("Support for allocation callbacks not implemented yet\n");
261 create_info_host
= *create_info
;
262 create_info_host
.surface
= surface_from_handle(create_info
->surface
)->surface
;
264 return pvkCreateSwapchainKHR(device
, &create_info_host
, NULL
/* allocator */, swapchain
);
267 static VkResult
X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance
,
268 const VkWin32SurfaceCreateInfoKHR
*create_info
,
269 const VkAllocationCallbacks
*allocator
, VkSurfaceKHR
*surface
)
272 VkXlibSurfaceCreateInfoKHR create_info_host
;
273 struct wine_vk_surface
*x11_surface
, *prev
;
275 TRACE("%p %p %p %p\n", instance
, create_info
, allocator
, surface
);
278 FIXME("Support for allocation callbacks not implemented yet\n");
280 /* TODO: support child window rendering. */
281 if (GetAncestor(create_info
->hwnd
, GA_PARENT
) != GetDesktopWindow())
283 FIXME("Application requires child window rendering, which is not implemented yet!\n");
284 return VK_ERROR_INCOMPATIBLE_DRIVER
;
287 x11_surface
= heap_alloc_zero(sizeof(*x11_surface
));
289 return VK_ERROR_OUT_OF_HOST_MEMORY
;
291 x11_surface
->ref
= 1;
293 x11_surface
->window
= create_client_window(create_info
->hwnd
, &default_visual
);
294 if (!x11_surface
->window
)
296 ERR("Failed to allocate client window for hwnd=%p\n", create_info
->hwnd
);
298 /* VK_KHR_win32_surface only allows out of host and device memory as errors. */
299 res
= VK_ERROR_OUT_OF_HOST_MEMORY
;
303 create_info_host
.sType
= VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR
;
304 create_info_host
.pNext
= NULL
;
305 create_info_host
.flags
= 0; /* reserved */
306 create_info_host
.dpy
= gdi_display
;
307 create_info_host
.window
= x11_surface
->window
;
309 res
= pvkCreateXlibSurfaceKHR(instance
, &create_info_host
, NULL
/* allocator */, &x11_surface
->surface
);
310 if (res
!= VK_SUCCESS
)
312 ERR("Failed to create Xlib surface, res=%d\n", res
);
316 EnterCriticalSection(&context_section
);
317 if (!XFindContext(gdi_display
, (XID
)create_info
->hwnd
, vulkan_hwnd_context
, (char **)&prev
))
319 wine_vk_surface_release(prev
);
321 XSaveContext(gdi_display
, (XID
)create_info
->hwnd
, vulkan_hwnd_context
, (char *)wine_vk_surface_grab(x11_surface
));
322 LeaveCriticalSection(&context_section
);
324 *surface
= (uintptr_t)x11_surface
;
326 TRACE("Created surface=0x%s\n", wine_dbgstr_longlong(*surface
));
330 wine_vk_surface_release(x11_surface
);
334 static void X11DRV_vkDestroyInstance(VkInstance instance
, const VkAllocationCallbacks
*allocator
)
336 TRACE("%p %p\n", instance
, allocator
);
339 FIXME("Support for allocation callbacks not implemented yet\n");
341 pvkDestroyInstance(instance
, NULL
/* allocator */);
344 static void X11DRV_vkDestroySurfaceKHR(VkInstance instance
, VkSurfaceKHR surface
,
345 const VkAllocationCallbacks
*allocator
)
347 struct wine_vk_surface
*x11_surface
= surface_from_handle(surface
);
349 TRACE("%p 0x%s %p\n", instance
, wine_dbgstr_longlong(surface
), allocator
);
352 FIXME("Support for allocation callbacks not implemented yet\n");
354 /* vkDestroySurfaceKHR must handle VK_NULL_HANDLE (0) for surface. */
357 pvkDestroySurfaceKHR(instance
, x11_surface
->surface
, NULL
/* allocator */);
359 wine_vk_surface_release(x11_surface
);
363 static void X11DRV_vkDestroySwapchainKHR(VkDevice device
, VkSwapchainKHR swapchain
,
364 const VkAllocationCallbacks
*allocator
)
366 TRACE("%p, 0x%s %p\n", device
, wine_dbgstr_longlong(swapchain
), allocator
);
369 FIXME("Support for allocation callbacks not implemented yet\n");
371 pvkDestroySwapchainKHR(device
, swapchain
, NULL
/* allocator */);
374 static VkResult
X11DRV_vkEnumerateInstanceExtensionProperties(const char *layer_name
,
375 uint32_t *count
, VkExtensionProperties
* properties
)
380 TRACE("layer_name %s, count %p, properties %p\n", debugstr_a(layer_name
), count
, properties
);
382 /* This shouldn't get called with layer_name set, the ICD loader prevents it. */
385 ERR("Layer enumeration not supported from ICD.\n");
386 return VK_ERROR_LAYER_NOT_PRESENT
;
389 /* We will return the same number of instance extensions reported by the host back to
390 * winevulkan. Along the way we may replace xlib extensions with their win32 equivalents.
391 * Winevulkan will perform more detailed filtering as it knows whether it has thunks
392 * for a particular extension.
394 res
= pvkEnumerateInstanceExtensionProperties(layer_name
, count
, properties
);
395 if (!properties
|| res
< 0)
398 for (i
= 0; i
< *count
; i
++)
400 /* For now the only x11 extension we need to fixup. Long-term we may need an array. */
401 if (!strcmp(properties
[i
].extensionName
, "VK_KHR_xlib_surface"))
403 TRACE("Substituting VK_KHR_xlib_surface for VK_KHR_win32_surface\n");
405 snprintf(properties
[i
].extensionName
, sizeof(properties
[i
].extensionName
),
406 VK_KHR_WIN32_SURFACE_EXTENSION_NAME
);
407 properties
[i
].specVersion
= VK_KHR_WIN32_SURFACE_SPEC_VERSION
;
411 TRACE("Returning %u extensions.\n", *count
);
415 static VkResult
X11DRV_vkGetDeviceGroupSurfacePresentModesKHR(VkDevice device
,
416 VkSurfaceKHR surface
, VkDeviceGroupPresentModeFlagsKHR
*flags
)
418 struct wine_vk_surface
*x11_surface
= surface_from_handle(surface
);
420 TRACE("%p, 0x%s, %p\n", device
, wine_dbgstr_longlong(surface
), flags
);
422 return pvkGetDeviceGroupSurfacePresentModesKHR(device
, x11_surface
->surface
, flags
);
425 static void *X11DRV_vkGetDeviceProcAddr(VkDevice device
, const char *name
)
429 TRACE("%p, %s\n", device
, debugstr_a(name
));
431 if ((proc_addr
= X11DRV_get_vk_device_proc_addr(name
)))
434 return pvkGetDeviceProcAddr(device
, name
);
437 static void *X11DRV_vkGetInstanceProcAddr(VkInstance instance
, const char *name
)
441 TRACE("%p, %s\n", instance
, debugstr_a(name
));
443 if ((proc_addr
= X11DRV_get_vk_instance_proc_addr(instance
, name
)))
446 return pvkGetInstanceProcAddr(instance
, name
);
449 static VkResult
X11DRV_vkGetPhysicalDevicePresentRectanglesKHR(VkPhysicalDevice phys_dev
,
450 VkSurfaceKHR surface
, uint32_t *count
, VkRect2D
*rects
)
452 struct wine_vk_surface
*x11_surface
= surface_from_handle(surface
);
454 TRACE("%p, 0x%s, %p, %p\n", phys_dev
, wine_dbgstr_longlong(surface
), count
, rects
);
456 return pvkGetPhysicalDevicePresentRectanglesKHR(phys_dev
, x11_surface
->surface
, count
, rects
);
459 static VkResult
X11DRV_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice phys_dev
,
460 VkSurfaceKHR surface
, VkSurfaceCapabilitiesKHR
*capabilities
)
462 struct wine_vk_surface
*x11_surface
= surface_from_handle(surface
);
464 TRACE("%p, 0x%s, %p\n", phys_dev
, wine_dbgstr_longlong(surface
), capabilities
);
466 return pvkGetPhysicalDeviceSurfaceCapabilitiesKHR(phys_dev
, x11_surface
->surface
, capabilities
);
469 static VkResult
X11DRV_vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice phys_dev
,
470 VkSurfaceKHR surface
, uint32_t *count
, VkSurfaceFormatKHR
*formats
)
472 struct wine_vk_surface
*x11_surface
= surface_from_handle(surface
);
474 TRACE("%p, 0x%s, %p, %p\n", phys_dev
, wine_dbgstr_longlong(surface
), count
, formats
);
476 return pvkGetPhysicalDeviceSurfaceFormatsKHR(phys_dev
, x11_surface
->surface
, count
, formats
);
479 static VkResult
X11DRV_vkGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice phys_dev
,
480 VkSurfaceKHR surface
, uint32_t *count
, VkPresentModeKHR
*modes
)
482 struct wine_vk_surface
*x11_surface
= surface_from_handle(surface
);
484 TRACE("%p, 0x%s, %p, %p\n", phys_dev
, wine_dbgstr_longlong(surface
), count
, modes
);
486 return pvkGetPhysicalDeviceSurfacePresentModesKHR(phys_dev
, x11_surface
->surface
, count
, modes
);
489 static VkResult
X11DRV_vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice phys_dev
,
490 uint32_t index
, VkSurfaceKHR surface
, VkBool32
*supported
)
492 struct wine_vk_surface
*x11_surface
= surface_from_handle(surface
);
494 TRACE("%p, %u, 0x%s, %p\n", phys_dev
, index
, wine_dbgstr_longlong(surface
), supported
);
496 return pvkGetPhysicalDeviceSurfaceSupportKHR(phys_dev
, index
, x11_surface
->surface
, supported
);
499 static VkBool32
X11DRV_vkGetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice phys_dev
,
502 TRACE("%p %u\n", phys_dev
, index
);
504 return pvkGetPhysicalDeviceXlibPresentationSupportKHR(phys_dev
, index
, gdi_display
,
505 default_visual
.visual
->visualid
);
508 static VkResult
X11DRV_vkGetSwapchainImagesKHR(VkDevice device
,
509 VkSwapchainKHR swapchain
, uint32_t *count
, VkImage
*images
)
511 TRACE("%p, 0x%s %p %p\n", device
, wine_dbgstr_longlong(swapchain
), count
, images
);
512 return pvkGetSwapchainImagesKHR(device
, swapchain
, count
, images
);
515 static VkResult
X11DRV_vkQueuePresentKHR(VkQueue queue
, const VkPresentInfoKHR
*present_info
)
519 TRACE("%p, %p\n", queue
, present_info
);
521 res
= pvkQueuePresentKHR(queue
, present_info
);
525 static unsigned long frames
, frames_total
;
526 static long prev_time
, start_time
;
529 time
= GetTickCount();
532 if (time
- prev_time
> 1500)
534 TRACE_(fps
)("%p @ approx %.2ffps, total %.2ffps\n",
535 queue
, 1000.0 * frames
/ (time
- prev_time
),
536 1000.0 * frames_total
/ (time
- start_time
));
547 static const struct vulkan_funcs vulkan_funcs
=
549 X11DRV_vkCreateInstance
,
550 X11DRV_vkCreateSwapchainKHR
,
551 X11DRV_vkCreateWin32SurfaceKHR
,
552 X11DRV_vkDestroyInstance
,
553 X11DRV_vkDestroySurfaceKHR
,
554 X11DRV_vkDestroySwapchainKHR
,
555 X11DRV_vkEnumerateInstanceExtensionProperties
,
556 X11DRV_vkGetDeviceGroupSurfacePresentModesKHR
,
557 X11DRV_vkGetDeviceProcAddr
,
558 X11DRV_vkGetInstanceProcAddr
,
559 X11DRV_vkGetPhysicalDevicePresentRectanglesKHR
,
560 X11DRV_vkGetPhysicalDeviceSurfaceCapabilitiesKHR
,
561 X11DRV_vkGetPhysicalDeviceSurfaceFormatsKHR
,
562 X11DRV_vkGetPhysicalDeviceSurfacePresentModesKHR
,
563 X11DRV_vkGetPhysicalDeviceSurfaceSupportKHR
,
564 X11DRV_vkGetPhysicalDeviceWin32PresentationSupportKHR
,
565 X11DRV_vkGetSwapchainImagesKHR
,
566 X11DRV_vkQueuePresentKHR
,
569 static void *X11DRV_get_vk_device_proc_addr(const char *name
)
571 return get_vulkan_driver_device_proc_addr(&vulkan_funcs
, name
);
574 static void *X11DRV_get_vk_instance_proc_addr(VkInstance instance
, const char *name
)
576 return get_vulkan_driver_instance_proc_addr(&vulkan_funcs
, instance
, name
);
579 const struct vulkan_funcs
*get_vulkan_driver(UINT version
)
581 static INIT_ONCE init_once
= INIT_ONCE_STATIC_INIT
;
583 if (version
!= WINE_VULKAN_DRIVER_VERSION
)
585 ERR("version mismatch, vulkan wants %u but driver has %u\n", version
, WINE_VULKAN_DRIVER_VERSION
);
589 InitOnceExecuteOnce(&init_once
, wine_vk_init
, NULL
, NULL
);
591 return &vulkan_funcs
;
596 #else /* No vulkan */
598 const struct vulkan_funcs
*get_vulkan_driver(UINT version
)
600 ERR("Wine was built without Vulkan support.\n");
604 void wine_vk_surface_destroy(HWND hwnd
)
608 #endif /* SONAME_LIBVULKAN */