• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
16
17TOOL_PATH=$3
18SHADER_PATH=$4
19INCLUDE_PATH=$5
20
21DEST_GEN_PATH=$1
22ASSETS_PATH=$2
23
24RENDER_INCLUDE_PATH=""
25
26if [ $# -eq 6 ];
27then
28    RENDER_INCLUDE_PATH=$6
29fi
30
31compile_shader()
32{
33	echo "Lume4 Compile shader $1 $2 $3 $4"
34    if [ -d "$DEST_GEN_PATH" ]; then
35        rm -rf $DEST_GEN_PATH
36        echo "Clean Output"
37    fi
38
39    mkdir -p $DEST_GEN_PATH
40    chmod -R 775 $DEST_GEN_PATH
41
42    cp -r ${ASSETS_PATH}/* $DEST_GEN_PATH
43    if [ -z "$RENDER_INCLUDE_PATH" ];
44    then
45        $TOOL_PATH/LumeShaderCompiler --optimize --source $SHADER_PATH --include $INCLUDE_PATH
46    else
47        $TOOL_PATH/LumeShaderCompiler --optimize --source $SHADER_PATH --include $INCLUDE_PATH --include $RENDER_INCLUDE_PATH
48    fi
49}
50
51compile_shader
52