[PATCH 04/10] winex11: Add stubs for global Vulkan functions.
Roderick Colenbrander
thunderbird2k at gmail.com
Tue Oct 31 12:24:49 CDT 2017
Signed-off-by: Roderick Colenbrander <thunderbird2k at gmail.com>
---
dlls/winex11.drv/Makefile.in | 1 +
dlls/winex11.drv/vulkan.c | 65 ++++++++++++++++++++++++++++++++++++++-
dlls/winex11.drv/vulkan_private.h | 45 +++++++++++++++++++++++++++
dlls/winex11.drv/vulkan_thunks.c | 18 +++++++++++
4 files changed, 128 insertions(+), 1 deletion(-)
create mode 100644 dlls/winex11.drv/vulkan_private.h
create mode 100644 dlls/winex11.drv/vulkan_thunks.c
diff --git a/dlls/winex11.drv/Makefile.in b/dlls/winex11.drv/Makefile.in
index 747f509b44..fc6c288d66 100644
--- a/dlls/winex11.drv/Makefile.in
+++ b/dlls/winex11.drv/Makefile.in
@@ -21,6 +21,7 @@ C_SRCS = \
settings.c \
systray.c \
vulkan.c \
+ vulkan_thunks.c \
window.c \
wintab.c \
x11drv_main.c \
diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c
index f58bad9c5a..cff474190a 100644
--- a/dlls/winex11.drv/vulkan.c
+++ b/dlls/winex11.drv/vulkan.c
@@ -25,6 +25,8 @@
#ifdef SONAME_LIBVULKAN
+#include "vulkan_private.h"
+
WINE_DEFAULT_DEBUG_CHANNEL(vulkan);
/* For now default to 3 as it felt like a reasonable version feature wise to support.
@@ -34,10 +36,71 @@ WINE_DEFAULT_DEBUG_CHANNEL(vulkan);
*/
#define WINE_VULKAN_ICD_VERSION 3
+void* WINAPI X11DRV_vk_icdGetInstanceProcAddr(VkInstance instance, const char* pName);
+
+
+static void *wine_vk_get_global_proc_addr(const char* name)
+{
+ int i;
+ for (i = 0; i < vk_global_dispatch_table_size; i++)
+ {
+ if (strcmp(name, vk_global_dispatch_table[i].name) == 0)
+ {
+ TRACE("Found pName=%s in global table\n", name);
+ return vk_global_dispatch_table[i].func;
+ }
+ }
+ return NULL;
+}
+
+VkResult WINAPI X11DRV_vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator,
+ VkInstance *pInstance)
+{
+ FIXME("stub: %p, %p, %p\n", pCreateInfo, pAllocator, pInstance);
+ return VK_ERROR_INCOMPATIBLE_DRIVER;
+}
+
+VkResult WINAPI X11DRV_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;
+}
+
+PFN_vkVoidFunction WINAPI X11DRV_vkGetInstanceProcAddr(VkInstance instance, const char* pName)
+{
+ /* Just forward to vk_icdGetInstanceProcAddr as they are equal. The vk_icd version was
+ * apparently added for dll injection reasons.
+ */
+ return X11DRV_vk_icdGetInstanceProcAddr(instance, pName);
+}
+/* Implementation of vk_icdGetInstanceProcAddr. We will load any function the caller requests
+ * and which we are aware of. Hopefully we don't have to do any extension filtering, which
+ * seems to be taken care of by the loader.
+ */
void* WINAPI X11DRV_vk_icdGetInstanceProcAddr(VkInstance instance, const char* pName)
{
- FIXME("stub: %p, %s\n", instance, pName ? pName : "NULL");
+ void *func;
+ TRACE("%p, %s\n", instance, pName ? pName : "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.
+ */
+ if (!instance)
+ {
+ func = wine_vk_get_global_proc_addr(pName);
+ if (!func)
+ {
+ TRACE("Function %s not found\n", pName);
+ return NULL;
+ }
+ return func;
+ }
+
+ /* TODO: add loading of instance and device functions. */
+ FIXME("Function %s not found\n", pName);
return NULL;
}
diff --git a/dlls/winex11.drv/vulkan_private.h b/dlls/winex11.drv/vulkan_private.h
new file mode 100644
index 0000000000..bb722ddb06
--- /dev/null
+++ b/dlls/winex11.drv/vulkan_private.h
@@ -0,0 +1,45 @@
+/* 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
+ */
+
+#ifndef __WINE_VULKAN_PRIVATE_H /* __WINE_VULKAN_PRIVATE_H */
+#define __WINE_VULKAN_PRIVATE_H
+
+#ifndef __WINE_CONFIG_H
+# error You must include config.h to use this header
+#endif
+
+#ifdef SONAME_LIBVULKAN
+
+struct vulkan_func
+{
+ const char *name;
+ const char *extension;
+ void *func;
+};
+
+/* For use by vk_icdGetInstanceProcAddr / vkGetInstanceProcAddr */
+extern const struct vulkan_func vk_global_dispatch_table[] DECLSPEC_HIDDEN;
+extern const int vk_global_dispatch_table_size DECLSPEC_HIDDEN;
+
+VkResult WINAPI X11DRV_vkCreateInstance(const VkInstanceCreateInfo*, const VkAllocationCallbacks*, VkInstance*) DECLSPEC_HIDDEN;
+VkResult WINAPI X11DRV_vkEnumerateInstanceExtensionProperties(const char*, uint32_t*, VkExtensionProperties*) DECLSPEC_HIDDEN;
+PFN_vkVoidFunction WINAPI X11DRV_vkGetInstanceProcAddr(VkInstance, const char*) DECLSPEC_HIDDEN;
+
+#endif /* SONAME_LIBVULKAN */
+#endif /* __WINE_VULKAN_PRIVATE_H */
diff --git a/dlls/winex11.drv/vulkan_thunks.c b/dlls/winex11.drv/vulkan_thunks.c
new file mode 100644
index 0000000000..fc3c65762a
--- /dev/null
+++ b/dlls/winex11.drv/vulkan_thunks.c
@@ -0,0 +1,18 @@
+/* Automatically generated from Vulkan vk.xml; DO NOT EDIT! */
+
+#include "config.h"
+#include "wine/port.h"
+
+#ifdef SONAME_LIBVULKAN
+
+#include "wine/vulkan.h"
+#include "vulkan_private.h"
+
+const struct vulkan_func vk_global_dispatch_table[] = {
+ {"vkCreateInstance", NULL, &X11DRV_vkCreateInstance},
+ {"vkEnumerateInstanceExtensionProperties", NULL, &X11DRV_vkEnumerateInstanceExtensionProperties},
+ {"vkGetInstanceProcAddr", NULL, &X11DRV_vkGetInstanceProcAddr},
+};
+const int vk_global_dispatch_table_size = 3;
+
+#endif /* SONAME_LIBVULKAN */
--
2.13.6
More information about the wine-patches
mailing list