[PATCH 06/10] winex11: Load vulkan library.

Roderick Colenbrander thunderbird2k at gmail.com
Tue Oct 31 12:24:52 CDT 2017


Signed-off-by: Roderick Colenbrander <thunderbird2k at gmail.com>
---
 dlls/winex11.drv/vulkan.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c
index e0e45d47ce..4171ee0fd6 100644
--- a/dlls/winex11.drv/vulkan.c
+++ b/dlls/winex11.drv/vulkan.c
@@ -21,6 +21,7 @@
 #include "wine/port.h"
 
 #include "wine/debug.h"
+#include "wine/library.h"
 #include "wine/vulkan.h"
 
 #ifdef SONAME_LIBVULKAN
@@ -39,6 +40,19 @@ WINE_DEFAULT_DEBUG_CHANNEL(vulkan);
 void* WINAPI X11DRV_vk_icdGetInstanceProcAddr(VkInstance instance, const char* pName);
 
 
+static BOOL wine_vk_init(void)
+{
+    static BOOL init_done = FALSE;
+    static void *vulkan_handle;
+
+    if (init_done) return (vulkan_handle != NULL);
+    init_done = TRUE;
+
+    if (!(vulkan_handle = wine_dlopen(SONAME_LIBVULKAN, RTLD_NOW, NULL, 0))) return FALSE;
+
+    return TRUE;
+}
+
 static void *wine_vk_get_global_proc_addr(const char* name)
 {
     int i;
@@ -60,6 +74,7 @@ VkResult WINAPI X11DRV_vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
     return VK_ERROR_INCOMPATIBLE_DRIVER;
 }
 
+
 VkResult WINAPI X11DRV_vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pPropertyCount,
         VkExtensionProperties* pProperties)
 {
@@ -107,6 +122,9 @@ void* WINAPI X11DRV_vk_icdGetInstanceProcAddr(VkInstance instance, const char* p
     void *func;
     TRACE("%p, %s\n", instance, pName ? pName : "NULL");
 
+    if (!wine_vk_init())
+        return NULL;
+
     /* Only global functions can be retrieved when NULL.
      * Note: the docs are not clear if we can still query global
      *       functions when a non-NULL instance object is passed in.
@@ -132,6 +150,9 @@ VkResult WINAPI X11DRV_vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t* pSuppo
     uint32_t req_version;
     TRACE("%p\n", pSupportedVersion);
 
+    if (!wine_vk_init())
+        return VK_ERROR_INCOMPATIBLE_DRIVER;
+
     /* The spec is not clear how to handle this. Mesa drivers don't check, but it
      * is probably best to not explode. VK_INCOMPLETE seems to be the closest value.
      */
-- 
2.13.6




More information about the wine-patches mailing list