[PATCH v3 06/10] winex11: Add Vulkan stubs.

Roderick Colenbrander thunderbird2k at gmail.com
Mon Feb 26 01:14:31 CST 2018


Signed-off-by: Roderick Colenbrander <thunderbird2k at gmail.com>
---
 dlls/winevulkan/vulkan.c     |  8 ++---
 dlls/winex11.drv/Makefile.in |  1 +
 dlls/winex11.drv/init.c      | 17 ++++++++++-
 dlls/winex11.drv/vulkan.c    | 71 ++++++++++++++++++++++++++++++++++++++++++++
 dlls/winex11.drv/x11drv.h    |  1 +
 5 files changed, 93 insertions(+), 5 deletions(-)
 create mode 100644 dlls/winex11.drv/vulkan.c

diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c
index ef98f03e37..8a3927c5c5 100644
--- a/dlls/winevulkan/vulkan.c
+++ b/dlls/winevulkan/vulkan.c
@@ -71,15 +71,15 @@ static BOOL wine_vk_init(HINSTANCE hinst)
 static VkResult WINAPI wine_vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator,
         VkInstance *pInstance)
 {
-    FIXME("stub: %p %p %p\n", pCreateInfo, pAllocator, pInstance);
-    return VK_ERROR_INCOMPATIBLE_DRIVER;
+    TRACE("%p %p %p\n", pCreateInfo, pAllocator, pInstance);
+    return vk_funcs->p_vkCreateInstance(pCreateInfo, pAllocator, pInstance);
 }
 
 static VkResult WINAPI wine_vkEnumerateInstanceExtensionProperties(const char *layer_name, uint32_t *count,
         VkExtensionProperties *properties)
 {
-    FIXME("stub: %p %p %p\n", layer_name, count, properties);
-    return VK_ERROR_OUT_OF_HOST_MEMORY;
+    TRACE("%p %p %p\n", layer_name, count, properties);
+    return vk_funcs->p_vkEnumerateInstanceExtensionProperties(layer_name, count, properties);
 }
 
 static PFN_vkVoidFunction WINAPI wine_vkGetInstanceProcAddr(VkInstance instance, const char *name)
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/init.c b/dlls/winex11.drv/init.c
index 24ed656405..be5537127a 100644
--- a/dlls/winex11.drv/init.c
+++ b/dlls/winex11.drv/init.c
@@ -345,6 +345,21 @@ static struct opengl_funcs * X11DRV_wine_get_wgl_driver( PHYSDEV dev, UINT versi
     return ret;
 }
 
+/**********************************************************************
+ *           X11DRV_wine_get_vulkan_driver
+ */
+static const struct vulkan_funcs * X11DRV_wine_get_vulkan_driver( PHYSDEV dev, UINT version )
+{
+    const struct vulkan_funcs *ret;
+
+    if (!(ret = get_vulkan_driver( version )))
+    {
+        dev = GET_NEXT_PHYSDEV( dev, wine_get_vulkan_driver );
+        ret = dev->funcs->wine_get_vulkan_driver( dev, version );
+    }
+    return ret;
+}
+
 
 static const struct gdi_dc_funcs x11drv_funcs =
 {
@@ -475,7 +490,7 @@ static const struct gdi_dc_funcs x11drv_funcs =
     X11DRV_UnrealizePalette,            /* pUnrealizePalette */
     NULL,                               /* pWidenPath */
     X11DRV_wine_get_wgl_driver,         /* wine_get_wgl_driver */
-    NULL,                               /* wine_get_vulkan_driver */
+    X11DRV_wine_get_vulkan_driver,      /* wine_get_vulkan_driver */
     GDI_PRIORITY_GRAPHICS_DRV           /* priority */
 };
 
diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c
new file mode 100644
index 0000000000..bfcf95a7ac
--- /dev/null
+++ b/dlls/winex11.drv/vulkan.c
@@ -0,0 +1,71 @@
+/* X11DRV Vulkan 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"
+#include "wine/vulkan_driver.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(vulkan);
+
+static VkResult X11DRV_vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator,
+        VkInstance *pInstance)
+{
+    FIXME("stub: %p %p %p\n", pCreateInfo, pAllocator, pInstance);
+    return VK_ERROR_INCOMPATIBLE_DRIVER;
+}
+
+static void X11DRV_vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator)
+{
+    FIXME("stub: %p %p\n", instance, pAllocator);
+}
+
+static VkResult X11DRV_vkEnumerateInstanceExtensionProperties(const char *layer_name, uint32_t *count,
+        VkExtensionProperties* properties)
+{
+    FIXME("stub: %s %p %p\n", debugstr_a(layer_name), count, properties);
+    return VK_ERROR_OUT_OF_HOST_MEMORY;
+}
+
+static void * X11DRV_vkGetInstanceProcAddr(VkInstance instance, const char *name)
+{
+    FIXME("stub: %p, %s\n", instance, debugstr_a(name));
+    return NULL;
+}
+
+static struct vulkan_funcs vulkan_funcs =
+{
+    X11DRV_vkCreateInstance,
+    X11DRV_vkDestroyInstance,
+    X11DRV_vkEnumerateInstanceExtensionProperties,
+    X11DRV_vkGetInstanceProcAddr
+};
+
+const struct vulkan_funcs *get_vulkan_driver(UINT version)
+{
+    if (version != WINE_VULKAN_DRIVER_VERSION)
+    {
+        ERR("version mismatch, vulkan wants %u but driver has %u\n", version, WINE_VULKAN_DRIVER_VERSION);
+        return NULL;
+    }
+
+    return &vulkan_funcs;
+}
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 72036279c6..abd069e1b4 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -223,6 +223,7 @@ extern BOOL shape_layered_windows DECLSPEC_HIDDEN;
 extern const struct gdi_dc_funcs *X11DRV_XRender_Init(void) DECLSPEC_HIDDEN;
 
 extern struct opengl_funcs *get_glx_driver(UINT) DECLSPEC_HIDDEN;
+extern const struct vulkan_funcs *get_vulkan_driver(UINT) DECLSPEC_HIDDEN;
 
 /* IME support */
 extern void IME_SetOpenStatus(BOOL fOpen) DECLSPEC_HIDDEN;
-- 
2.14.3




More information about the wine-devel mailing list