lmbr_pak_shaders.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/bin/sh
  2. #
  3. # All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
  4. # its licensors.
  5. #
  6. # For complete copyright and license terms please see the LICENSE at the root of this
  7. # distribution (the "License"). All use of this software is governed by the License,
  8. # or, if provided, by the license below or the license accompanying this file. Do not
  9. # remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
  10. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. #
  12. #
  13. if [ -z "$3" ]; then
  14. echo "Missing one or more required params. Usage:\nlmbr_pak_shaders.sh gameProjectName GLES3|METAL es3|ios|osx_gl [source shader list path]"
  15. exit 1
  16. fi
  17. # Extract an optional external engine path if present, otherwise use the cwd as the engine dir
  18. EXTERNAL_ENGINE_PATH=`cat engine.json | grep "ExternalEnginePath" | awk -F":" '{ print $2 }' | sed "s/,//g" | sed "s/\"//g" | xargs echo -n`
  19. if [ -z $EXTERNAL_ENGINE_PATH ]; then
  20. ENGINE_DIR=$(dirname "$0")
  21. elif [ -d $EXTERNAL_ENGINE_PATH ]; then
  22. ENGINE_DIR=$EXTERNAL_ENGINE_PATH
  23. else
  24. echo External Path in engine.json "$EXTERNAL_ENGINE_PATH" does not exist
  25. exit 1
  26. fi
  27. BIN_FOLDER=mac
  28. if [ -z "$BIN_FOLDER" ]; then
  29. echo Unable to find mac bin output folder.
  30. exit 1
  31. fi
  32. py="$ENGINE_DIR/python/python.sh"
  33. game="$1"
  34. shader_type="$2"
  35. asset_platform="$3"
  36. source_shader_list="$4"
  37. gen_args="$game $asset_platform $shader_type -b $BIN_FOLDER -e $ENGINE_DIR"
  38. if [ ! -z $source_shader_list ]; then
  39. gen_args=$gen_args -s $source_shader_list
  40. fi
  41. env $py "$ENGINE_DIR/Tools/PakShaders/gen_shaders.py" $gen_args
  42. if [ $? -ne 0 ]; then
  43. echo Failed to generate shaders.
  44. exit 1
  45. fi
  46. source="Cache/$game/$asset_platform/user/cache/shaders/cache"
  47. output="Build/$asset_platform/$game"
  48. env $py "$ENGINE_DIR/Tools/PakShaders/pak_shaders.py" $output -r $source -s $shader_type
  49. if [ $? -ne 0 ]; then
  50. echo Failed to pack shaders.
  51. exit 1
  52. fi