Commit 0d23ecd9 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

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: 's avatarZhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: 's avatarKen Thomases <ken@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 0c2f5f8b
......@@ -8954,6 +8954,46 @@ rm -f core conftest.err conftest.$ac_objext \
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"
then
ac_save_LIBS="$LIBS"
......
......@@ -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
......
......@@ -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 @@ done:
return ret;
}
#ifdef HAVE_METAL_METAL_H
#ifdef HAVE_MTLDEVICE_REGISTRYID
/***********************************************************************
* macdrv_get_gpu_info_from_registry_id
......@@ -337,7 +337,6 @@ done:
static int macdrv_get_gpus_from_metal(struct macdrv_gpu** new_gpus, int* count)
{
TRACE("Metal support not compiled in\n");
return -1;
}
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment