[PATCH 6/9] winex11: Add Vulkan stubs and call them from winevulkan.

Roderick Colenbrander thunderbird2k at gmail.com
Mon Nov 6 02:08:22 CST 2017


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

diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c
index ee96071940..887351f187 100644
--- a/dlls/winevulkan/vulkan.c
+++ b/dlls/winevulkan/vulkan.c
@@ -88,15 +88,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->vkCreateInstance(pCreateInfo, pAllocator, pInstance);
 }
 
 static VkResult WINAPI wine_vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pPropertyCount,
         VkExtensionProperties* pProperties)
 {
-    FIXME("stub: %p %p %p\n", pLayerName, pPropertyCount, pProperties);
-    return VK_ERROR_OUT_OF_HOST_MEMORY;
+    TRACE("%p %p %p\n", pLayerName, pPropertyCount, pProperties);
+    return vk_funcs->vkEnumerateInstanceExtensionProperties(pLayerName, pPropertyCount, pProperties);
 }
 
 static PFN_vkVoidFunction WINAPI wine_vkGetInstanceProcAddr(VkInstance instance, const char* pName)
diff --git a/dlls/winex11.drv/Makefile.in b/dlls/winex11.drv/Makefile.in
index 463eefdcfb..a542490f53 100644
--- a/dlls/winex11.drv/Makefile.in
+++ b/dlls/winex11.drv/Makefile.in
@@ -28,6 +28,7 @@ C_SRCS = \
 	xinerama.c \
 	xrandr.c \
 	xrender.c \
-	xvidmode.c
+	xvidmode.c \
+	vulkan.c
 
 RC_SRCS = version.rc
diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c
index 24ed656405..a9b186c067 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 struct vulkan_funcs * X11DRV_wine_get_vulkan_driver( PHYSDEV dev, UINT version )
+{
+    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..b89d64fe87
--- /dev/null
+++ b/dlls/winex11.drv/vulkan.c
@@ -0,0 +1,57 @@
+/* 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"
+#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 VkResult X11DRV_vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pPropertyCount,
+        VkExtensionProperties* pProperties)
+{
+    FIXME("stub: %s %p %p\n", debugstr_a(pLayerName), pPropertyCount, pProperties);
+    return VK_ERROR_OUT_OF_HOST_MEMORY;
+}
+
+static struct vulkan_funcs vulkan_funcs = {
+    X11DRV_vkCreateInstance,
+    X11DRV_vkEnumerateInstanceExtensionProperties
+};
+
+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 721c082ed1..4c9d81c679 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 struct vulkan_funcs *get_vulkan_driver(UINT) DECLSPEC_HIDDEN;
 
 /* IME support */
 extern void IME_SetOpenStatus(BOOL fOpen) DECLSPEC_HIDDEN;
-- 
2.13.6




More information about the wine-patches mailing list