winemac: Implement WineMetalView class.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Ken Thomases 2018-07-13 09:27:44 -05:00 committed by Alexandre Julliard
parent e27abb0a3a
commit 357017cd87
6 changed files with 755 additions and 1 deletions

593
configure vendored
View File

@ -705,6 +705,7 @@ CROSSCC
CROSSTARGET
PRELINK
WINELOADER_DEPENDS
METAL_LIBS
CARBON_LIBS
QUICKTIME_LIBS
OPENCL_LIBS
@ -718,6 +719,10 @@ APPLICATIONSERVICES_LIBS
FORCEFEEDBACK_LIBS
IOKIT_LIBS
COREFOUNDATION_LIBS
OBJCPP
ac_ct_OBJC
OBJCFLAGS
OBJC
LIBWINE_DEPENDS
LIBWINE_LDFLAGS
LIBWINE_INSTALL_DEV
@ -1771,6 +1776,9 @@ CXX
CXXFLAGS
CCC
CPP
OBJC
OBJCFLAGS
OBJCPP
XMKMF
XML2_CFLAGS
XML2_LIBS
@ -2532,6 +2540,9 @@ Some influential environment variables:
CXX C++ compiler command
CXXFLAGS C++ compiler flags
CPP C preprocessor
OBJC Objective C compiler command
OBJCFLAGS Objective C compiler flags
OBJCPP Objective C preprocessor
XMKMF Path to xmkmf, Makefile generator for X Window System
XML2_CFLAGS C compiler flags for libxml-2.0, overriding pkg-config
XML2_LIBS Linker flags for libxml-2.0, overriding pkg-config
@ -3010,6 +3021,172 @@ $as_echo "$ac_res" >&6; }
} # ac_fn_c_check_header_compile
# ac_fn_objc_try_compile LINENO
# -----------------------------
# Try to compile conftest.$ac_ext, and return whether this succeeded.
ac_fn_objc_try_compile ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
rm -f conftest.$ac_objext
if { { ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compile") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
cat conftest.er1 >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && {
test -z "$ac_objc_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then :
ac_retval=0
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_objc_try_compile
# ac_fn_objc_try_cpp LINENO
# -------------------------
# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
ac_fn_objc_try_cpp ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if { { ac_try="$ac_cpp conftest.$ac_ext"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
cat conftest.er1 >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } > conftest.i && {
test -z "$ac_objc_preproc_warn_flag$ac_objc_werror_flag" ||
test ! -s conftest.err
}; then :
ac_retval=0
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_objc_try_cpp
# ac_fn_objc_check_header_mongrel LINENO HEADER VAR INCLUDES
# ----------------------------------------------------------
# Tests whether HEADER exists, giving a warning if it cannot be compiled using
# the include files in INCLUDES and setting the cache variable VAR
# accordingly.
ac_fn_objc_check_header_mongrel ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if eval \${$3+:} false; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
else
# Is the header compilable?
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
$as_echo_n "checking $2 usability... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
#include <$2>
_ACEOF
if ac_fn_objc_try_compile "$LINENO"; then :
ac_header_compiler=yes
else
ac_header_compiler=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
$as_echo "$ac_header_compiler" >&6; }
# Is the header present?
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
$as_echo_n "checking $2 presence... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <$2>
_ACEOF
if ac_fn_objc_try_cpp "$LINENO"; then :
ac_header_preproc=yes
else
ac_header_preproc=no
fi
rm -f conftest.err conftest.i conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
$as_echo "$ac_header_preproc" >&6; }
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_objc_preproc_warn_flag in #((
yes:no: )
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
;;
no:yes:* )
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
( $as_echo "## ------------------------------------ ##
## Report this to wine-devel@winehq.org ##
## ------------------------------------ ##"
) | sed "s/^/$as_me: WARNING: /" >&2
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
eval "$3=\$ac_header_compiler"
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_objc_check_header_mongrel
# ac_fn_c_check_func LINENO FUNC VAR
# ----------------------------------
# Tests whether FUNC exists, setting the cache variable VAR accordingly
@ -7993,6 +8170,416 @@ fi
done
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
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
if test -n "$ac_tool_prefix"; then
for ac_prog in gcc objcc objc cc CC
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_OBJC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$OBJC"; then
ac_cv_prog_OBJC="$OBJC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_OBJC="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
OBJC=$ac_cv_prog_OBJC
if test -n "$OBJC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJC" >&5
$as_echo "$OBJC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$OBJC" && break
done
fi
if test -z "$OBJC"; then
ac_ct_OBJC=$OBJC
for ac_prog in gcc objcc objc cc CC
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_OBJC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_OBJC"; then
ac_cv_prog_ac_ct_OBJC="$ac_ct_OBJC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_OBJC="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_OBJC=$ac_cv_prog_ac_ct_OBJC
if test -n "$ac_ct_OBJC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJC" >&5
$as_echo "$ac_ct_OBJC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$ac_ct_OBJC" && break
done
if test "x$ac_ct_OBJC" = x; then
OBJC="gcc"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
OBJC=$ac_ct_OBJC
fi
fi
# Provide some information about the compiler.
$as_echo "$as_me:${as_lineno-$LINENO}: checking for Objective C compiler version" >&5
set X $ac_compile
ac_compiler=$2
for ac_option in --version -v -V -qversion; do
{ { ac_try="$ac_compiler $ac_option >&5"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compiler $ac_option >&5") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
sed '10a\
... rest of stderr output deleted ...
10q' conftest.err >conftest.er1
cat conftest.er1 >&5
fi
rm -f conftest.er1 conftest.err
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU Objective C compiler" >&5
$as_echo_n "checking whether we are using the GNU Objective C compiler... " >&6; }
if ${ac_cv_objc_compiler_gnu+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
#ifndef __GNUC__
choke me
#endif
;
return 0;
}
_ACEOF
if ac_fn_objc_try_compile "$LINENO"; then :
ac_compiler_gnu=yes
else
ac_compiler_gnu=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_objc_compiler_gnu=$ac_compiler_gnu
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objc_compiler_gnu" >&5
$as_echo "$ac_cv_objc_compiler_gnu" >&6; }
if test $ac_compiler_gnu = yes; then
GOBJC=yes
else
GOBJC=
fi
ac_test_OBJCFLAGS=${OBJCFLAGS+set}
ac_save_OBJCFLAGS=$OBJCFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $OBJC accepts -g" >&5
$as_echo_n "checking whether $OBJC accepts -g... " >&6; }
if ${ac_cv_prog_objc_g+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_save_objc_werror_flag=$ac_objc_werror_flag
ac_objc_werror_flag=yes
ac_cv_prog_objc_g=no
OBJCFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_objc_try_compile "$LINENO"; then :
ac_cv_prog_objc_g=yes
else
OBJCFLAGS=""
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_objc_try_compile "$LINENO"; then :
else
ac_objc_werror_flag=$ac_save_objc_werror_flag
OBJCFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_objc_try_compile "$LINENO"; then :
ac_cv_prog_objc_g=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_objc_werror_flag=$ac_save_objc_werror_flag
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_objc_g" >&5
$as_echo "$ac_cv_prog_objc_g" >&6; }
if test "$ac_test_OBJCFLAGS" = set; then
OBJCFLAGS=$ac_save_OBJCFLAGS
elif test $ac_cv_prog_objc_g = yes; then
if test "$GOBJC" = yes; then
OBJCFLAGS="-g -O2"
else
OBJCFLAGS="-g"
fi
else
if test "$GOBJC" = yes; then
OBJCFLAGS="-O2"
else
OBJCFLAGS=
fi
fi
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
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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the Objective C preprocessor" >&5
$as_echo_n "checking how to run the Objective C preprocessor... " >&6; }
if test -z "$OBJCPP"; then
if ${ac_cv_prog_OBJCPP+:} false; then :
$as_echo_n "(cached) " >&6
else
# Double quotes because OBJCPP needs to be expanded
for OBJCPP in "$OBJC -E" "/lib/cpp"
do
ac_preproc_ok=false
for ac_objc_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
# <limits.h> exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
Syntax error
_ACEOF
if ac_fn_objc_try_cpp "$LINENO"; then :
else
# Broken: fails on valid input.
continue
fi
rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <ac_nonexistent.h>
_ACEOF
if ac_fn_objc_try_cpp "$LINENO"; then :
# Broken: success on invalid input.
continue
else
# Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
break
fi
done
ac_cv_prog_OBJCPP=$OBJCPP
fi
OBJCPP=$ac_cv_prog_OBJCPP
else
ac_cv_prog_OBJCPP=$OBJCPP
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJCPP" >&5
$as_echo "$OBJCPP" >&6; }
ac_preproc_ok=false
for ac_objc_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
# <limits.h> exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
Syntax error
_ACEOF
if ac_fn_objc_try_cpp "$LINENO"; then :
else
# Broken: fails on valid input.
continue
fi
rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <ac_nonexistent.h>
_ACEOF
if ac_fn_objc_try_cpp "$LINENO"; then :
# Broken: success on invalid input.
continue
else
# Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "Objective C preprocessor \"$OBJCPP\" fails sanity check
See \`config.log' for more details" "$LINENO" 5; }
fi
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
for ac_header in Metal/Metal.h
do :
ac_fn_objc_check_header_mongrel "$LINENO" "Metal/Metal.h" "ac_cv_header_Metal_Metal_h" "$ac_includes_default"
if test "x$ac_cv_header_Metal_Metal_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_METAL_METAL_H 1
_ACEOF
fi
done
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
LIBEXT="dylib"
DLLFLAGS="$DLLFLAGS -fPIC"
LDRPATH_INSTALL="-Wl,-rpath,@loader_path/\`\$(MAKEDEP) -R \${bindir} \${libdir}\`"
@ -8159,6 +8746,11 @@ rm -f core conftest.err conftest.$ac_objext \
then
CARBON_LIBS="-framework Carbon"
fi
if test "$ac_cv_header_Metal_Metal_h" = "yes"
then
METAL_LIBS="-framework Metal -framework QuartzCore"
fi
if test "$ac_cv_header_ApplicationServices_ApplicationServices_h" = "yes"
@ -18228,6 +18820,7 @@ OPENAL_LIBS = $OPENAL_LIBS
OPENCL_LIBS = $OPENCL_LIBS
QUICKTIME_LIBS = $QUICKTIME_LIBS
CARBON_LIBS = $CARBON_LIBS
METAL_LIBS = $METAL_LIBS
PTHREAD_LIBS = $PTHREAD_LIBS
X_CFLAGS = $X_CFLAGS
X_PRE_LIBS = $X_PRE_LIBS

View File

@ -762,6 +762,9 @@ case $host_os in
darwin*|macosx*)
AC_CHECK_HEADERS(libunwind.h)
AC_LANG_PUSH([Objective C])
AC_CHECK_HEADERS(Metal/Metal.h)
AC_LANG_POP([Objective C])
LIBEXT="dylib"
DLLFLAGS="$DLLFLAGS -fPIC"
LDRPATH_INSTALL="-Wl,-rpath,@loader_path/\`\$(MAKEDEP) -R \${bindir} \${libdir}\`"
@ -846,6 +849,10 @@ case $host_os in
then
AC_SUBST(CARBON_LIBS,"-framework Carbon")
fi
if test "$ac_cv_header_Metal_Metal_h" = "yes"
then
AC_SUBST(METAL_LIBS,"-framework Metal -framework QuartzCore")
fi
dnl Enable Mac driver on Mac OS X 10.6 or later
if test "$ac_cv_header_ApplicationServices_ApplicationServices_h" = "yes"

View File

@ -1,7 +1,7 @@
MODULE = winemac.drv
IMPORTS = uuid user32 gdi32 advapi32
DELAYIMPORTS = ole32 shell32 imm32
EXTRALIBS = -framework AppKit -framework Carbon -framework Security -framework OpenGL -framework IOKit -framework CoreVideo
EXTRALIBS = -framework AppKit -framework Carbon -framework Security -framework OpenGL -framework IOKit -framework CoreVideo $(METAL_LIBS)
C_SRCS = \
clipboard.c \

View File

@ -18,8 +18,14 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#import <Carbon/Carbon.h>
#import <CoreVideo/CoreVideo.h>
#ifdef HAVE_METAL_METAL_H
#import <Metal/Metal.h>
#import <QuartzCore/QuartzCore.h>
#endif
#import "cocoa_window.h"
@ -303,6 +309,18 @@ @interface WineBaseView : NSView
@end
#ifdef HAVE_METAL_METAL_H
@interface WineMetalView : WineBaseView
{
id<MTLDevice> _device;
}
- (id) initWithFrame:(NSRect)frame device:(id<MTLDevice>)device;
@end
#endif
@interface WineContentView : WineBaseView <NSTextInputClient>
{
NSMutableArray* glContexts;
@ -316,6 +334,10 @@ @interface WineContentView : WineBaseView <NSTextInputClient>
NSRange markedTextSelection;
int backingSize[2];
#ifdef HAVE_METAL_METAL_H
WineMetalView *_metalView;
#endif
}
@property (readonly, nonatomic) BOOL everHadGLContext;
@ -327,6 +349,10 @@ - (void) updateGLContexts;
- (void) wine_getBackingSize:(int*)outBackingSize;
- (void) wine_setBackingSize:(const int*)newBackingSize;
#ifdef HAVE_METAL_METAL_H
- (WineMetalView*) newMetalViewWithDevice:(id<MTLDevice>)device;
#endif
@end
@ -628,6 +654,23 @@ - (void) wine_setBackingSize:(const int*)newBackingSize
}
}
#ifdef HAVE_METAL_METAL_H
- (WineMetalView*) newMetalViewWithDevice:(id<MTLDevice>)device
{
if (_metalView) return _metalView;
WineMetalView* view = [[WineMetalView alloc] initWithFrame:[self bounds] device:device];
[view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
[self setAutoresizesSubviews:YES];
[self addSubview:view positioned:NSWindowBelow relativeTo:nil];
_metalView = view;
[(WineWindow*)self.window windowDidDrawContent];
return _metalView;
}
#endif
- (void) setRetinaMode:(int)mode
{
double scale = mode ? 0.5 : 2.0;
@ -693,6 +736,10 @@ - (void) willRemoveSubview:(NSView*)subview
if (!view->_cachedHasGLDescendantValid || view->_cachedHasGLDescendant)
[self invalidateHasGLDescendant];
}
#ifdef HAVE_METAL_METAL_H
if (subview == _metalView)
_metalView = nil;
#endif
[super willRemoveSubview:subview];
}
@ -833,6 +880,53 @@ - (NSInteger) windowLevel
@end
#ifdef HAVE_METAL_METAL_H
@implementation WineMetalView
- (id) initWithFrame:(NSRect)frame device:(id<MTLDevice>)device
{
self = [super initWithFrame:frame];
if (self)
{
_device = [device retain];
self.wantsLayer = YES;
self.layerContentsRedrawPolicy = NSViewLayerContentsRedrawNever;
}
return self;
}
- (void) dealloc
{
[_device release];
[super dealloc];
}
- (void) setRetinaMode:(int)mode
{
self.layer.contentsScale = mode ? 2.0 : 1.0;
[super setRetinaMode:mode];
}
- (CALayer*) makeBackingLayer
{
CAMetalLayer *layer = [CAMetalLayer layer];
layer.device = _device;
layer.framebufferOnly = YES;
layer.magnificationFilter = kCAFilterNearest;
layer.backgroundColor = CGColorGetConstantColor(kCGColorBlack);
layer.contentsScale = retina_on ? 2.0 : 1.0;
return layer;
}
- (BOOL) isOpaque
{
return YES;
}
@end
#endif
@implementation WineWindow
static WineWindow* causing_becomeKeyWindow;
@ -3492,6 +3586,7 @@ macdrv_view macdrv_create_view(CGRect rect)
view = [[WineContentView alloc] initWithFrame:NSRectFromCGRect(cgrect_mac_from_win(rect))];
[view setAutoresizesSubviews:NO];
[view setAutoresizingMask:NSViewNotSizable];
[view setHidden:YES];
[nc addObserver:view
selector:@selector(updateGLContexts)
@ -3679,6 +3774,52 @@ void macdrv_remove_view_opengl_context(macdrv_view v, macdrv_opengl_context c)
[pool release];
}
#ifdef HAVE_METAL_METAL_H
macdrv_metal_device macdrv_create_metal_device(void)
{
macdrv_metal_device ret;
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_11
if (MTLCreateSystemDefaultDevice == NULL)
return NULL;
#endif
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
ret = (macdrv_metal_device)MTLCreateSystemDefaultDevice();
[pool release];
return ret;
}
void macdrv_release_metal_device(macdrv_metal_device d)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
[(id<MTLDevice>)d release];
[pool release];
}
macdrv_metal_view macdrv_view_create_metal_view(macdrv_view v, macdrv_metal_device d)
{
id<MTLDevice> device = (id<MTLDevice>)d;
WineContentView* view = (WineContentView*)v;
__block WineMetalView *metalView;
OnMainThread(^{
metalView = [view newMetalViewWithDevice:device];
});
return (macdrv_metal_view)metalView;
}
void macdrv_view_release_metal_view(macdrv_metal_view v)
{
WineMetalView* view = (WineMetalView*)v;
OnMainThread(^{
[view removeFromSuperview];
[view release];
});
}
#endif
int macdrv_get_view_backing_size(macdrv_view v, int backing_size[2])
{
WineContentView* view = (WineContentView*)v;

View File

@ -138,6 +138,10 @@
typedef struct macdrv_opaque_event_queue* macdrv_event_queue;
typedef struct macdrv_opaque_view* macdrv_view;
typedef struct macdrv_opaque_opengl_context* macdrv_opengl_context;
#ifdef HAVE_METAL_METAL_H
typedef struct macdrv_opaque_metal_device* macdrv_metal_device;
typedef struct macdrv_opaque_metal_view* macdrv_metal_view;
#endif
typedef struct macdrv_opaque_status_item* macdrv_status_item;
struct macdrv_event;
struct macdrv_query;
@ -527,6 +531,12 @@ extern void macdrv_set_window_color_key(macdrv_window w, CGFloat keyRed, CGFloat
extern void macdrv_set_view_hidden(macdrv_view v, int hidden) DECLSPEC_HIDDEN;
extern void macdrv_add_view_opengl_context(macdrv_view v, macdrv_opengl_context c) DECLSPEC_HIDDEN;
extern void macdrv_remove_view_opengl_context(macdrv_view v, macdrv_opengl_context c) DECLSPEC_HIDDEN;
#ifdef HAVE_METAL_METAL_H
extern macdrv_metal_device macdrv_create_metal_device(void) DECLSPEC_HIDDEN;
extern void macdrv_release_metal_device(macdrv_metal_device d) DECLSPEC_HIDDEN;
extern macdrv_metal_view macdrv_view_create_metal_view(macdrv_view v, macdrv_metal_device d) DECLSPEC_HIDDEN;
extern void macdrv_view_release_metal_view(macdrv_metal_view v) DECLSPEC_HIDDEN;
#endif
extern int macdrv_get_view_backing_size(macdrv_view v, int backing_size[2]) DECLSPEC_HIDDEN;
extern void macdrv_set_view_backing_size(macdrv_view v, const int backing_size[2]) DECLSPEC_HIDDEN;
extern uint32_t macdrv_window_background_color(void) DECLSPEC_HIDDEN;

View File

@ -603,6 +603,9 @@
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <Metal/Metal.h> header file. */
#undef HAVE_METAL_METAL_H
/* Define to 1 if you have the `mmap' function. */
#undef HAVE_MMAP