[PATCH v2 4/5] winevulkan: Implement vkGetDeviceProcAddr.

Roderick Colenbrander thunderbird2k at gmail.com
Fri Mar 9 10:48:49 CST 2018


Signed-off-by: Roderick Colenbrander <thunderbird2k at gmail.com>
---
 dlls/winevulkan/make_vulkan     |  2 +-
 dlls/winevulkan/vulkan.c        | 22 ++++++++++++++++++++++
 dlls/winevulkan/vulkan_thunks.c |  6 ------
 dlls/winevulkan/vulkan_thunks.h |  1 +
 4 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan
index afb379901e..b86ecd4c55 100755
--- a/dlls/winevulkan/make_vulkan
+++ b/dlls/winevulkan/make_vulkan
@@ -94,7 +94,7 @@ FUNCTION_OVERRIDES = {
     "vkEnumeratePhysicalDevices" : {"dispatch" : True, "driver" : False, "thunk" : False},
 
     # Device functions
-    "vkGetDeviceProcAddr" : {"dispatch" : True, "driver" : True, "thunk" : True},
+    "vkGetDeviceProcAddr" : {"dispatch" : True, "driver" : True, "thunk" : False},
 }
 
 
diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c
index 83c94eb856..ee877e0f80 100644
--- a/dlls/winevulkan/vulkan.c
+++ b/dlls/winevulkan/vulkan.c
@@ -352,6 +352,28 @@ VkResult WINAPI wine_vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *d
     return res;
 }
 
+PFN_vkVoidFunction WINAPI wine_vkGetDeviceProcAddr(VkDevice device, const char *name)
+{
+    void *func;
+    TRACE("%p, %s\n", device, debugstr_a(name));
+
+    /* The spec leaves return value undefined for a NULL device, let's just return NULL. */
+    if (!device || !name)
+        return NULL;
+
+    /* Per the spec, we are only supposed to return device functions as in functions
+     * for which the first parameter is vkDevice or a child of vkDevice like a
+     * vkCommandBuffer or vkQueue.
+     * Loader takes are of filtering of extensions which are enabled or not.
+     */
+    func = wine_vk_get_device_proc_addr(name);
+    if (func)
+        return func;
+
+    TRACE("Function %s not found\n", debugstr_a(name));
+    return NULL;
+}
+
 static PFN_vkVoidFunction WINAPI wine_vkGetInstanceProcAddr(VkInstance instance, const char *name)
 {
     void *func;
diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c
index f02ee3e2bf..13a5d5d7ea 100644
--- a/dlls/winevulkan/vulkan_thunks.c
+++ b/dlls/winevulkan/vulkan_thunks.c
@@ -690,12 +690,6 @@ static void WINAPI wine_vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMem
     FIXME("stub: %p, 0x%s, %p\n", device, wine_dbgstr_longlong(memory), pCommittedMemoryInBytes);
 }
 
-static PFN_vkVoidFunction WINAPI wine_vkGetDeviceProcAddr(VkDevice device, const char *pName)
-{
-    FIXME("stub: %p, %p\n", device, pName);
-    return NULL;
-}
-
 static void WINAPI wine_vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue)
 {
     FIXME("stub: %p, %u, %u, %p\n", device, queueFamilyIndex, queueIndex, pQueue);
diff --git a/dlls/winevulkan/vulkan_thunks.h b/dlls/winevulkan/vulkan_thunks.h
index 0a30090a57..d137a2b34f 100644
--- a/dlls/winevulkan/vulkan_thunks.h
+++ b/dlls/winevulkan/vulkan_thunks.h
@@ -17,6 +17,7 @@ VkResult WINAPI wine_vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDev
 void WINAPI wine_vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) DECLSPEC_HIDDEN;
 VkResult WINAPI wine_vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties) DECLSPEC_HIDDEN;
 VkResult WINAPI wine_vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, VkPhysicalDevice *pPhysicalDevices) DECLSPEC_HIDDEN;
+PFN_vkVoidFunction WINAPI wine_vkGetDeviceProcAddr(VkDevice device, const char *pName) DECLSPEC_HIDDEN;
 
 typedef struct VkImageFormatProperties_host
 {
-- 
2.14.3




More information about the wine-devel mailing list