1#!/bin/bash 2# Copyright (C) 2024 Huawei Device Co., Ltd. 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15set -e 16WORKING_DIR=$(cd "$(dirname "$0")"; pwd) 17PROJECT_ROOT=${WORKING_DIR%/LumeEngine*} 18echo ${PROJECT_ROOT} 19 20TOOL_PATH=$3 21SHADER_PATH=$4 22INCLUDE_PATH=$5 23 24DEST_GEN_PATH=$1 25ASSETS_PATH=$2 26 27RENDER_INCLUDE_PATH="" 28 29if [ $# -eq 6 ]; 30then 31 RENDER_INCLUDE_PATH=$6 32fi 33 34compile_shader() 35{ 36 echo "Lume4 Compile shader $1 $2 $3 $4" 37 if [ -d "$DEST_GEN_PATH" ]; then 38 rm -rf $DEST_GEN_PATH 39 echo "Clean Output" 40 fi 41 TEST_TOOL_PATH=$TOOL_PATH/../LumeBinaryCompile/LumeShaderCompiler 42 mkdir -p $DEST_GEN_PATH 43 chmod -R 775 $DEST_GEN_PATH 44 45 cp -r ${ASSETS_PATH}/* $DEST_GEN_PATH 46 if [ -z "$RENDER_INCLUDE_PATH" ]; 47 then 48 $TEST_TOOL_PATH/LumeShaderCompiler --optimize --source $SHADER_PATH --include $PROJECT_ROOT/LumeRender/api/ 49 else 50 $TEST_TOOL_PATH/LumeShaderCompiler --optimize --source $SHADER_PATH --include $PROJECT_ROOT/Lume_3D/api/ --include $PROJECT_ROOT/LumeRender/api/ 51 fi 52} 53 54compile_shader 55