diff --git a/tools/compile_shader.sh b/tools/compile_shader.sh index 8255d65..7146a26 100755 --- a/tools/compile_shader.sh +++ b/tools/compile_shader.sh @@ -4,13 +4,13 @@ # See README in the root project for more information. # ----------------------------------------------------------------------------- -# If no arguments have been given, exit with error code 1 +# If no arguments have been given if [ "$#" -ne 2 ]; then echo "ERROR: missing arguments, use as follows: $0 " 1>&2 exit 1 fi -# If file cannot be found, exit with error code 2 +# If file cannot be found if [ ! -f "$1" ]; then echo "ERROR: shader file not found: $1" 1>&2 exit 2 @@ -31,15 +31,10 @@ echo "#include \"MLX42/MLX42_Int.h\"" echo "" { - # Start building the shader string - if [ "$2" -eq 1 ]; then - # Output WASM specific lines + if [ "$2" -eq 1 ]; then # Output WASM specific lines echo "const char* ${SHADERTYPE}_shader = \"#version 300 es\\n\"" - if [ "$SHADERTYPE" = "frag" ]; then - echo " \"precision mediump float;\"" - fi - else - # Non-Wasm, output the original shader version + echo " \"precision mediump float;\"" + else # Non-Wasm, output the original shader version echo "const char* ${SHADERTYPE}_shader = \"$(sed -n '1{p;q;}' "$1")\\n\"" fi