From 295b6301447963351d1daab64743215d3e419d69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Sat, 24 Mar 2018 14:28:04 +0100 Subject: [PATCH] winex11: Return Wine Vulkan driver functions from vkGetDeviceProcAddr(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Roderick Colenbrander Signed-off-by: Alexandre Julliard --- dlls/winex11.drv/vulkan.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index d40afb30b2c..c633579286e 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -77,6 +77,7 @@ static VkBool32 (*pvkGetPhysicalDeviceXlibPresentationSupportKHR)(VkPhysicalDevi static VkResult (*pvkGetSwapchainImagesKHR)(VkDevice, VkSwapchainKHR, uint32_t *, VkImage *); static VkResult (*pvkQueuePresentKHR)(VkQueue, const VkPresentInfoKHR *); +static void *X11DRV_get_vk_device_proc_addr(const char *name); static void *X11DRV_get_vk_instance_proc_addr(VkInstance instance, const char *name); static struct VkExtensionProperties *winex11_vk_instance_extensions = NULL; @@ -397,9 +398,15 @@ static VkResult X11DRV_vkEnumerateInstanceExtensionProperties(const char *layer_ return *count < winex11_vk_instance_extensions_count ? VK_INCOMPLETE : VK_SUCCESS; } -static void * X11DRV_vkGetDeviceProcAddr(VkDevice device, const char *name) +static void *X11DRV_vkGetDeviceProcAddr(VkDevice device, const char *name) { + void *proc_addr; + TRACE("%p, %s\n", device, debugstr_a(name)); + + if ((proc_addr = X11DRV_get_vk_device_proc_addr(name))) + return proc_addr; + return pvkGetDeviceProcAddr(device, name); } @@ -545,6 +552,35 @@ static void *X11DRV_get_vk_instance_proc_addr(VkInstance instance, const char *n return get_vulkan_driver_instance_proc_addr(&vulkan_funcs, instance, name); } +static void *get_vulkan_driver_device_proc_addr(const struct vulkan_funcs *vulkan_funcs, + const char *name) +{ + if (!name || name[0] != 'v' || name[1] != 'k') + return NULL; + + name += 2; + + if (!strcmp(name, "AcquireNextImageKHR")) + return vulkan_funcs->p_vkAcquireNextImageKHR; + if (!strcmp(name, "CreateSwapchainKHR")) + return vulkan_funcs->p_vkCreateSwapchainKHR; + if (!strcmp(name, "DestroySwapchainKHR")) + return vulkan_funcs->p_vkDestroySwapchainKHR; + if (!strcmp(name, "GetDeviceProcAddr")) + return vulkan_funcs->p_vkGetDeviceProcAddr; + if (!strcmp(name, "GetSwapchainImagesKHR")) + return vulkan_funcs->p_vkGetSwapchainImagesKHR; + if (!strcmp(name, "QueuePresentKHR")) + return vulkan_funcs->p_vkQueuePresentKHR; + + return NULL; +} + +static void *X11DRV_get_vk_device_proc_addr(const char *name) +{ + return get_vulkan_driver_device_proc_addr(&vulkan_funcs, name); +} + const struct vulkan_funcs *get_vulkan_driver(UINT version) { if (version != WINE_VULKAN_DRIVER_VERSION)