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>
This commit is contained in:
Zhiyi Zhang 2019-09-02 12:04:21 +08:00 committed by Alexandre Julliard
parent 0c2f5f8b15
commit 0d23ecd9ec
4 changed files with 57 additions and 3 deletions

40
configure vendored
View File

@ -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"

View File

@ -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

View File

@ -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;
}

View File

@ -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