]> git.xonotic.org Git - xonotic/xonotic.git/blob - misc/tools/the-big-benchmark/the-big-benchmark-eh.sh
Allow more timeout stealing. Small tickling, should fix compile of
[xonotic/xonotic.git] / misc / tools / the-big-benchmark / the-big-benchmark-eh.sh
1 #!/bin/sh
2
3 set -e
4
5 if [ -d "${0%/*}" ]; then
6         cd "${0%/*}"
7 fi
8 cd ../../..
9
10 echo "The Big Benchmark"
11 echo " ================="
12 echo
13 if [ -f ./all ]; then
14         echo "WARNING: running this script will destroy ANY local changes you"
15         echo "might have on the repository that haven't been pushed or stored"
16         echo "in a local branch yet."
17         echo
18         if [ x"$1" != x"--yes" ]; then
19                 echo "Are you absolutely sure you want to run this?"
20                 echo
21                 while :; do
22                         echo -n "y/n: "
23                         read -r yesno
24                         case "$yesno" in
25                                 y)
26                                         break
27                                         ;;
28                                 n)
29                                         echo "Aborted."
30                                         exit 1
31                                         ;;
32                         esac
33                 done
34         fi
35 fi
36
37 if [ -f ./all ]; then
38         ./all clean -fU -m -r
39         ./all compile -r
40         export USE_GDB=no
41         set -- ./all run "$@"
42 elif [ -z "$*" ]; then
43         case "`uname`" in
44                 Darwin)
45                         set -- ./Xonotic.app/Contents/MacOS/xonotic-osx-sdl
46                         ;;
47                 Linux)
48                         set -- ./xonotic-linux-sdl.sh
49                         ;;
50                 *)
51                         echo "OS not detected. Usage:"
52                         echo "  $0 how-to-run-xonotic"
53                         echo "On Windows when using a release build or an autobuild,"
54                         echo "use the-big-benchmark.bat instead!"
55                         exit 1
56                         ;;
57         esac
58 fi
59 rm -f data/the-big-benchmark.log
60 rm -f data/benchmark.log
61 rm -f data/engine.log
62
63 # for next version of benchmark: remove +cl_playerdetailreduction 0 and add +showfps 1
64 p="+cl_curl_enabled 0 +r_texture_dds_load 1 +cl_playerdetailreduction 0 +developer 1 -nohome -benchmarkruns 4 -benchmarkruns_skipfirst -benchmark demos/the-big-keybench.dem"
65
66 for e in omg low med normal high ultra ultimate; do
67         echo "Benchmarking on $e"
68         rm -f data/benchmark.log
69         echo + "$@" +exec effects-$e.cfg $p > data/engine.log
70         "$@" +exec effects-$e.cfg $p >>data/engine.log 2>&1 || true
71         grep "^MED: " data/engine.log # print results to the terminal
72         if grep '\]quit' data/engine.log >/dev/null; then
73                 break
74         fi
75         cat data/engine.log >> data/the-big-benchmark.log
76         cat data/benchmark.log >> data/the-big-benchmark.log
77 # If card does not support OpenGL then break
78         if [ x"$e" = x"med" ]; then
79                 if grep 'checking for OpenGL 2\.0 core features\.\.\.  not detected' data/engine.log; then
80                         echo "OpenGL 2.0 or later required for Normal quality and higher, exiting."
81                         break
82                 fi
83         fi
84 # If vid_gl20 is set to 0 then break
85         if [ x"$e" = x"med" ]; then
86                 if grep 'Using GL1.3 rendering path' data/engine.log; then
87                         echo "OpenGL 2.0 rendering disabled, exiting."
88                         break
89                 fi
90         fi
91         if [ x"$e" = x"high" ]; then
92                 if grep 'vid_soft 1' data/engine.log; then
93                         echo "Software rendering does not support Ultra and Ultimate quality settings, exiting."
94                         break
95                 fi
96         fi
97 done
98
99 if [ -f ./all ]; then
100         ./all clean -r
101 fi
102
103 rm -f data/benchmark.log
104 rm -f data/engine.log
105 if ! [ -f data/the-big-benchmark.log ]; then
106         echo
107         echo "The benchmark has been aborted. No log file has been written."
108         exit
109 fi
110
111 echo
112 echo "Please provide the the following info to the Xonotic developers:"
113 echo " - CPU speed"
114 echo " - memory size"
115 echo " - graphics card (which vendor, which model)"
116 echo " - operating system (including whether it is 32bit or 64bit)"
117 echo " - graphics driver version"
118 echo " - the file the-big-benchmark.log in the data directory"
119 echo
120 echo "Thank you"