src/render/metal/build-metal-shaders.sh
changeset 11730 ac6c607e065c
parent 11729 d1ce8396c356
equal deleted inserted replaced
11729:d1ce8396c356 11730:ac6c607e065c
     1 #!/bin/bash
     1 #!/bin/bash
     2 
     2 
     3 set -x
     3 set -x
     4 set -e
     4 set -e
       
     5 cd `dirname "$0"`
     5 
     6 
     6 cd `dirname "$0"`
     7 generate_shaders()
     7 rm -f sdl.air sdl.metalar sdl.metallib
     8 {
     8 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metal -std=osx-metal1.1 -Wall -O3 -o ./sdl.air ./SDL_shaders_metal.metal
     9     platform=$1
     9 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metal-ar rc sdl.metalar sdl.air
    10     /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 $?
    10 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metallib -o sdl.metallib sdl.metalar
    11     /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metal-ar rc sdl.metalar sdl.air || exit $?
    11 xxd -i sdl.metallib |perl -w -p -e 's/\Aunsigned /const unsigned /;' >./SDL_shaders_metal.c
    12     /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metallib -o sdl.metallib sdl.metalar || exit $?
    12 rm -f sdl.air sdl.metalar sdl.metallib
    13     xxd -i sdl.metallib | perl -w -p -e 's/\Aunsigned /const unsigned /;' >./SDL_shaders_metal_$platform.h
       
    14     rm -f sdl.air sdl.metalar sdl.metallib
       
    15 }
    13 
    16 
       
    17 generate_shaders osx
       
    18 generate_shaders ios