[PATCH v2] winemac.drv: Fix build with older macOS SDKs.

Zhiyi Zhang zzhang at codeweavers.com
Sun Sep 1 23:04:21 CDT 2019


macOS SDKs older than 10.11 doesn't support Metal.
macOS 10.11 and 10.12 SDK support Metal but don't
support registryID in MTLDevice protocol. Recommend
using 10.13+ SDK.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
v2: Supersede 169291. Fix build with macOS 10.11 and 10.12 SDKs as well.

 configure.ac                     | 12 ++++++++++++
 dlls/winemac.drv/cocoa_display.m |  5 ++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index d0af7ef4a1..a9e1da886d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -859,6 +859,18 @@ case $host_os in
         AC_SUBST(METAL_LIBS,"-framework Metal -framework QuartzCore")
     fi
 
+    dnl Check for MTLDevice registryID property
+    if test "$ac_cv_header_Metal_Metal_h" = "yes"
+    then
+        AC_MSG_CHECKING([whether MTLDevice protocol supports registryID property])
+        AC_LANG_PUSH([Objective C])
+        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <Metal/Metal.h>]], [[id<MTLDevice> device; device.registryID;]])],
+                              [AC_MSG_RESULT(yes)
+                               AC_DEFINE(HAVE_MTLDEVICE_REGISTRYID, 1, [Define if MTLDevice protocol has registryID property.])],
+                              [AC_MSG_RESULT(no)])
+        AC_LANG_POP([Objective C])
+    fi
+
     dnl Enable Mac driver on Mac OS X 10.6 or later
     if test "$ac_cv_header_ApplicationServices_ApplicationServices_h" = "yes"
     then
diff --git a/dlls/winemac.drv/cocoa_display.m b/dlls/winemac.drv/cocoa_display.m
index 3863557d96..9d95eee99a 100644
--- a/dlls/winemac.drv/cocoa_display.m
+++ b/dlls/winemac.drv/cocoa_display.m
@@ -21,7 +21,7 @@
 #include "config.h"
 
 #import <AppKit/AppKit.h>
-#ifdef HAVE_METAL_METAL_H
+#ifdef HAVE_MTLDEVICE_REGISTRYID
 #import <Metal/Metal.h>
 #endif
 #include "macdrv_cocoa.h"
@@ -234,7 +234,7 @@ static int macdrv_get_gpu_info_from_entry(struct macdrv_gpu* gpu, io_registry_en
     return ret;
 }
 
-#ifdef HAVE_METAL_METAL_H
+#ifdef HAVE_MTLDEVICE_REGISTRYID
 
 /***********************************************************************
  *              macdrv_get_gpu_info_from_registry_id
@@ -337,7 +337,6 @@ static int macdrv_get_gpus_from_metal(struct macdrv_gpu** new_gpus, int* count)
 
 static int macdrv_get_gpus_from_metal(struct macdrv_gpu** new_gpus, int* count)
 {
-    TRACE("Metal support not compiled in\n");
     return -1;
 }
 
-- 
2.15.2 (Apple Git-101.1)



More information about the wine-devel mailing list