Repository navigation
Expand file tree
/
Copy pathrun.sh
More file actions
38 lines (38 loc) · 1.94 KB
/
Copy pathrun.sh
File metadata and controls
38 lines (38 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env bash
set -euo pipefail
cd -- "$(dirname -- "$0")"
if [[ ${1:-} == --software ]]; then
shift
if [[ -z ${VK_DRIVER_FILES:-} ]]; then
for candidate in /run/opengl-driver/share/vulkan/icd.d/lvp_icd*.json /usr/share/vulkan/icd.d/lvp_icd*.json; do
if [[ -f $candidate ]]; then export VK_DRIVER_FILES=$candidate; break; fi
done
fi
if [[ -z ${VK_DRIVER_FILES:-} ]]; then echo 'Lavapipe not found; set VK_DRIVER_FILES.' >&2; exit 1; fi
export VK_LOADER_LAYERS_DISABLE='~implicit~'
fi
# THEORDER_PREBUILT=1 (packaged builds, the AppImage): bin/theorder-probe and its GPU library are installed
# next to this script; nothing is built and no nix-shell is needed.
# THEORDER_DATA_DIR: writable directory for the generated files (out/), saves (user/) and theorder.ini;
# by default this directory. The preparation itself is in run.py.
data=${THEORDER_DATA_DIR:-.}
if [[ -z ${THEORDER_PREBUILT:-} && -z ${THEORDER_IN_NIX_SHELL:-} ]] && ! { command -v pkg-config >/dev/null && pkg-config --exists vulkan sdl3; } && command -v nix-shell >/dev/null; then
args=''; if (( $# )); then args=$(printf '%q ' "$@"); fi
exec env THEORDER_IN_NIX_SHELL=1 nix-shell shell.nix --run "bash run.sh $args"
fi
if [[ -z ${PYTHON:-} ]]; then
PYTHON=$(command -v python3 || true)
if [[ -z $PYTHON ]]; then
for candidate in /nix/store/*-python3-*/bin/python3; do
if [[ -x $candidate ]]; then PYTHON=$candidate; break; fi
done
fi
fi
if [[ -z ${PYTHON:-} ]]; then echo 'Install Python 3 or set PYTHON.' >&2; exit 1; fi
# FSR 4: faster post passes next to the downloaded ones (incremental; tools/fsr4_optimize.sh).
if [[ -z ${THEORDER_PREBUILT:-} && -d fsr4_shaders ]] && command -v spirv-cross >/dev/null; then
bash tools/fsr4_optimize.sh || echo 'FSR 4: optimized post passes not built' >&2
fi
if [[ -z ${THEORDER_PREBUILT:-} ]]; then bash build.sh; fi
export THEORDER_DATA_DIR=$data
exec "$PYTHON" run.py "$@"