mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-01-28 22:04:43 -08:00
142 lines
4.7 KiB
Diff
142 lines
4.7 KiB
Diff
From 0d23ecd9ec8a0c24e5444e0fc9cf6933cc39c960 Mon Sep 17 00:00:00 2001
|
|
From: Zhiyi Zhang <zzhang@codeweavers.com>
|
|
Date: Mon, 2 Sep 2019 12:04:21 +0800
|
|
Subject: [PATCH] winemac.drv: Fix build with older macOS SDKs.
|
|
|
|
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@codeweavers.com>
|
|
Signed-off-by: Ken Thomases <ken@codeweavers.com>
|
|
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
|
|
---
|
|
configure | 40 ++++++++++++++++++++++++++++++++
|
|
configure.ac | 12 ++++++++++
|
|
dlls/winemac.drv/cocoa_display.m | 5 ++--
|
|
include/config.h.in | 3 +++
|
|
4 files changed, 57 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/configure b/configure
|
|
index a52e346b68..0c54e27f5f 100755
|
|
--- a/configure
|
|
+++ b/configure
|
|
@@ -8952,6 +8952,46 @@ rm -f core conftest.err conftest.$ac_objext \
|
|
then
|
|
METAL_LIBS="-framework Metal -framework QuartzCore"
|
|
|
|
+ fi
|
|
+
|
|
+ if test "$ac_cv_header_Metal_Metal_h" = "yes"
|
|
+ then
|
|
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether MTLDevice protocol supports registryID property" >&5
|
|
+$as_echo_n "checking whether MTLDevice protocol supports registryID property... " >&6; }
|
|
+ ac_ext=m
|
|
+ac_cpp='$OBJCPP $CPPFLAGS'
|
|
+ac_compile='$OBJC -c $OBJCFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
|
+ac_link='$OBJC -o conftest$ac_exeext $OBJCFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
|
+ac_compiler_gnu=$ac_cv_objc_compiler_gnu
|
|
+
|
|
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
+/* end confdefs.h. */
|
|
+#include <Metal/Metal.h>
|
|
+int
|
|
+main ()
|
|
+{
|
|
+id<MTLDevice> device; device.registryID;
|
|
+ ;
|
|
+ return 0;
|
|
+}
|
|
+_ACEOF
|
|
+if ac_fn_objc_try_compile "$LINENO"; then :
|
|
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
|
+$as_echo "yes" >&6; }
|
|
+
|
|
+$as_echo "#define HAVE_MTLDEVICE_REGISTRYID 1" >>confdefs.h
|
|
+
|
|
+else
|
|
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
|
+$as_echo "no" >&6; }
|
|
+fi
|
|
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
|
+ ac_ext=c
|
|
+ac_cpp='$CPP $CPPFLAGS'
|
|
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
|
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
|
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
|
+
|
|
fi
|
|
|
|
if test "$ac_cv_header_ApplicationServices_ApplicationServices_h" = "yes"
|
|
diff --git a/configure.ac b/configure.ac
|
|
index 1592812bf7..b39b6b2c90 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;
|
|
}
|
|
|
|
diff --git a/include/config.h.in b/include/config.h.in
|
|
index 924e11eac0..5f690df7b0 100644
|
|
--- a/include/config.h.in
|
|
+++ b/include/config.h.in
|
|
@@ -584,6 +584,9 @@
|
|
/* Define to 1 if you have the <mpg123.h> header file. */
|
|
#undef HAVE_MPG123_H
|
|
|
|
+/* Define if MTLDevice protocol has registryID property. */
|
|
+#undef HAVE_MTLDEVICE_REGISTRYID
|
|
+
|
|
/* Define to 1 if you have the <ncurses.h> header file. */
|
|
#undef HAVE_NCURSES_H
|
|
|
|
--
|
|
2.23.0.rc1
|
|
|