[PATCH 02/10] winex11: Add stub Vulkan ICD

Roderick Colenbrander <[email protected]>
Newsgroups gmane.comp.emulators.wine.patches
Message-ID <[email protected]>
Signed-off-by: Roderick Colenbrander <[email protected]>
---
 configure.ac                      |  9 +++++++
 dlls/winex11.drv/Makefile.in      |  1 +
 dlls/winex11.drv/vulkan.c         | 54 +++++++++++++++++++++++++++++++++++++++
 dlls/winex11.drv/winex11.drv.spec |  4 +++
 include/config.h.in               |  3 +++
 5 files changed, 71 insertions(+)
 create mode 100644 dlls/winex11.drv/vulkan.c

diff --git a/configure.ac b/configure.ac
index c02253bb86..4766c0e6c0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -78,6 +78,7 @@ AC_ARG_WITH(sane,      AS_HELP_STRING([--without-sane],[do not use SANE (scanner
 AC_ARG_WITH(tiff,      AS_HELP_STRING([--without-tiff],[do not use TIFF]))
 AC_ARG_WITH(udev,      AS_HELP_STRING([--without-udev],[do not use udev (plug and play support)]))
 AC_ARG_WITH(v4l,       AS_HELP_STRING([--without-v4l],[do not use v4l1 (v4l support)]))
+AC_ARG_WITH(vulkan,    AS_HELP_STRING([--without-vulkan],[do not use vulkan]))
 AC_ARG_WITH(xcomposite,AS_HELP_STRING([--without-xcomposite],[do not use the Xcomposite extension]),
             [if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_Xcomposite_h=no; fi])
 AC_ARG_WITH(xcursor,   AS_HELP_STRING([--without-xcursor],[do not use the Xcursor extension]),
@@ -1786,6 +1787,14 @@ then
     WINE_WARNING([No sound system was found. Windows applications will be silent.])
 fi
 
+dnl *** Check for vulkan ***
+if test "x$with_vulkan" != "xno"
+then
+    WINE_CHECK_SONAME(vulkan, vkGetInstanceProcAddr)
+fi
+WINE_NOTICE_WITH(vulkan,[test "x$ac_cv_lib_soname_vulkan" = "x"],
+                 [libvulkan ${notice_platform}development files not found, vulkan won't be supported.])
+
 dnl **** Check for gcc specific options ****
 
 AC_SUBST(EXTRACFLAGS,"")
diff --git a/dlls/winex11.drv/Makefile.in b/dlls/winex11.drv/Makefile.in
index 463eefdcfb..747f509b44 100644
--- a/dlls/winex11.drv/Makefile.in
+++ b/dlls/winex11.drv/Makefile.in
@@ -20,6 +20,7 @@ C_SRCS = \
 	pen.c \
 	settings.c \
 	systray.c \
+	vulkan.c \
 	window.c \
 	wintab.c \
 	x11drv_main.c \
diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c
new file mode 100644
index 0000000000..936e5620d2
--- /dev/null
+++ b/dlls/winex11.drv/vulkan.c
@@ -0,0 +1,54 @@
+/* X11DRV Vulkan ICD implementation
+ *
+ * Copyright 2017 Roderick Colenbrander
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "config.h"
+#include "wine/port.h"
+
+#include "wine/debug.h"
+#include "wine/vulkan.h"
+
+#ifdef SONAME_LIBVULKAN
+
+WINE_DEFAULT_DEBUG_CHANNEL(vulkan);
+
+void* WINAPI X11DRV_vk_icdGetInstanceProcAddr(VkInstance instance, const char* pName)
+{
+    FIXME("stub: %p, %s\n", instance, pName ? pName : "NULL");
+    return NULL;
+}
+
+VkResult WINAPI X11DRV_vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t* pSupportedVersion)
+{
+    FIXME("stub: %p\n", pSupportedVersion);
+    return VK_INCOMPLETE;
+}
+
+#else /* No vulkan */
+
+void* WINAPI X11DRV_vk_icdGetInstanceProcAddr(VkInstance instance, const char* pName)
+{
+    return NULL;
+}
+
+VkResult WINAPI X11DRV_vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t* pSupportedVersion)
+{
+    return VK_INCOMPLETE;
+}
+
+#endif /* defined SONAME_LIBVULKAN */
diff --git a/dlls/winex11.drv/winex11.drv.spec b/dlls/winex11.drv/winex11.drv.spec
index 614f0b90f4..0932a2c88e 100644
--- a/dlls/winex11.drv/winex11.drv.spec
+++ b/dlls/winex11.drv/winex11.drv.spec
@@ -78,3 +78,7 @@
 @ stdcall ImeProcessKey(long long long ptr)
 @ stdcall ImeGetRegisterWordStyle(long ptr)
 @ stdcall ImeGetImeMenuItems(long long long ptr ptr long)
+
+# Vulkan
+@ stdcall vk_icdGetInstanceProcAddr(ptr str) X11DRV_vk_icdGetInstanceProcAddr
+@ stdcall vk_icdNegotiateLoaderICDInterfaceVersion(ptr) X11DRV_vk_icdNegotiateLoaderICDInterfaceVersion
diff --git a/include/config.h.in b/include/config.h.in
index a6ec41b5fa..444f4595d4 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -1541,6 +1541,9 @@
 /* Define to the soname of the libXxf86vm library. */
 #undef SONAME_LIBXXF86VM
 
+/* Define to the soname of the libvulkan library. */
+#undef SONAME_LIBVULKAN
+
 /* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
 #undef STAT_MACROS_BROKEN
 
-- 
2.13.6
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.