Georg Lehmann : winemac.drv: Only return vulkan functions if the host function is available.

Alexandre Julliard julliard at winehq.org
Fri Aug 20 16:12:56 CDT 2021


Module: wine
Branch: master
Commit: 6dee57f30ec65975ce6ecd689d5b6c3a2cc8d0ec
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6dee57f30ec65975ce6ecd689d5b6c3a2cc8d0ec

Author: Georg Lehmann <dadschoorse at gmail.com>
Date:   Fri Aug 20 13:24:48 2021 +0200

winemac.drv: Only return vulkan functions if the host function is available.

Signed-off-by: Georg Lehmann <dadschoorse at gmail.com>
Signed-off-by: Liam Middlebrook <lmiddlebrook at nvidia.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winemac.drv/vulkan.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/dlls/winemac.drv/vulkan.c b/dlls/winemac.drv/vulkan.c
index 21ebcc56519..f546e3ccfa5 100644
--- a/dlls/winemac.drv/vulkan.c
+++ b/dlls/winemac.drv/vulkan.c
@@ -420,12 +420,32 @@ static VkResult macdrv_vkEnumerateInstanceExtensionProperties(const char *layer_
     return res;
 }
 
+static const char *wine_vk_native_fn_name(const char *name)
+{
+    const char *create_surface_name =
+        pvkCreateMetalSurfaceEXT ? "vkCreateMetalSurfaceEXT" : "vkCreateMacOSSurfaceMVK";
+
+    if (!strcmp(name, "vkCreateWin32SurfaceKHR"))
+        return create_surface_name;
+    /* We just need something where non-NULL is returned if the correct extension is enabled.
+     * So since there is no native equivalent of this function check for the create
+     * surface function.
+     */
+    if (!strcmp(name, "vkGetPhysicalDeviceWin32PresentationSupportKHR"))
+        return create_surface_name;
+
+    return name;
+}
+
 static void *macdrv_vkGetDeviceProcAddr(VkDevice device, const char *name)
 {
     void *proc_addr;
 
     TRACE("%p, %s\n", device, debugstr_a(name));
 
+    if (!pvkGetDeviceProcAddr(device, wine_vk_native_fn_name(name)))
+        return NULL;
+
     if ((proc_addr = macdrv_get_vk_device_proc_addr(name)))
         return proc_addr;
 
@@ -438,6 +458,9 @@ static void *macdrv_vkGetInstanceProcAddr(VkInstance instance, const char *name)
 
     TRACE("%p, %s\n", instance, debugstr_a(name));
 
+    if (!pvkGetInstanceProcAddr(instance, wine_vk_native_fn_name(name)))
+        return NULL;
+
     if ((proc_addr = macdrv_get_vk_instance_proc_addr(instance, name)))
         return proc_addr;
 




More information about the wine-cvs mailing list