[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-patches
Subject:    [PATCH 06/10] winex11: Load vulkan library.
From:       Roderick Colenbrander <thunderbird2k () gmail ! com>
Date:       2017-10-31 17:24:52
Message-ID: 20171031172456.2230-9-thunderbird2k () gmail ! com
[Download RAW message or body]

Signed-off-by: Roderick Colenbrander <thunderbird2k@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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic