From 9e57e3e5957d23aa265ccfb1790f12cad274a109 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Fri, 16 Aug 2019 22:11:50 -0300 Subject: [PATCH] metal: Update shader compilation script with fixes for newer xcode versions and for running on older platforms --- src/render/metal/build-metal-shaders.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/render/metal/build-metal-shaders.sh b/src/render/metal/build-metal-shaders.sh index 8ebf63eab..fb4ddb7de 100755 --- a/src/render/metal/build-metal-shaders.sh +++ b/src/render/metal/build-metal-shaders.sh @@ -6,13 +6,17 @@ cd `dirname "$0"` generate_shaders() { - platform=$1 - /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metal -std=$platform-metal1.1 -Wall -O3 -o ./sdl.air ./SDL_shaders_metal.metal || exit $? - /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metal-ar rc sdl.metalar sdl.air || exit $? - /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metallib -o sdl.metallib sdl.metalar || exit $? - xxd -i sdl.metallib | perl -w -p -e 's/\Aunsigned /const unsigned /;' >./SDL_shaders_metal_$platform.h + fileplatform=$1 + compileplatform=$2 + sdkplatform=$3 + minversion=$4 + xcrun -sdk $sdkplatform metal -c -std=$compileplatform-metal1.1 -m$sdkplatform-version-min=$minversion -Wall -O3 -o ./sdl.air ./SDL_shaders_metal.metal || exit $? + xcrun -sdk $sdkplatform metal-ar rc sdl.metalar sdl.air || exit $? + xcrun -sdk $sdkplatform metallib -o sdl.metallib sdl.metalar || exit $? + xxd -i sdl.metallib | perl -w -p -e 's/\Aunsigned /const unsigned /;' >./SDL_shaders_metal_$fileplatform.h rm -f sdl.air sdl.metalar sdl.metallib } -generate_shaders osx -generate_shaders ios +generate_shaders osx osx macosx 10.11 +generate_shaders ios ios iphoneos 8.0 +generate_shaders tvos ios appletvos 9.0