src/render/metal/build-metal-shaders.sh
changeset 11730 ac6c607e065c
parent 11729 d1ce8396c356
child 13016 e25b2c6a8155
     1.1 --- a/src/render/metal/build-metal-shaders.sh	Thu Apr 21 03:16:44 2016 -0400
     1.2 +++ b/src/render/metal/build-metal-shaders.sh	Thu Dec 07 16:08:09 2017 -0800
     1.3 @@ -2,12 +2,17 @@
     1.4  
     1.5  set -x
     1.6  set -e
     1.7 +cd `dirname "$0"`
     1.8  
     1.9 -cd `dirname "$0"`
    1.10 -rm -f sdl.air sdl.metalar sdl.metallib
    1.11 -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metal -std=osx-metal1.1 -Wall -O3 -o ./sdl.air ./SDL_shaders_metal.metal
    1.12 -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metal-ar rc sdl.metalar sdl.air
    1.13 -/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metallib -o sdl.metallib sdl.metalar
    1.14 -xxd -i sdl.metallib |perl -w -p -e 's/\Aunsigned /const unsigned /;' >./SDL_shaders_metal.c
    1.15 -rm -f sdl.air sdl.metalar sdl.metallib
    1.16 +generate_shaders()
    1.17 +{
    1.18 +    platform=$1
    1.19 +    /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 $?
    1.20 +    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metal-ar rc sdl.metalar sdl.air || exit $?
    1.21 +    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metallib -o sdl.metallib sdl.metalar || exit $?
    1.22 +    xxd -i sdl.metallib | perl -w -p -e 's/\Aunsigned /const unsigned /;' >./SDL_shaders_metal_$platform.h
    1.23 +    rm -f sdl.air sdl.metalar sdl.metallib
    1.24 +}
    1.25  
    1.26 +generate_shaders osx
    1.27 +generate_shaders ios