summaryrefslogtreecommitdiff
path: root/tests.d/mesa/UnrealEngine4.test
blob: 0a3e08ed43e43833477df02ba957d3447592d91f (plain)
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
39
40
41
42
43
44
45
# WARNING: Requires libframetime: https://github.com/clbr/libframetime
test -e "$LIBFRAMETIME64_SO" || return 1
test -d "$UE4_FOLDER" || return 1

# 5 arguments: $rounds $fps_logs_file $runID $benchmark $benchmark_params
__ue4__() {
    eval benchmark="$4"
    test -d "$benchmark" || return 1
    benchmark=$(find "$benchmark" -type f -executable ! -name CrashReportClient)

    for (( c=$3; c<$1+$3; c++ ))
    do
        rm -f /tmp/frametime.log

        LIBFRAMETIME_FILE=/tmp/frametime.log LD_PRELOAD=$LIBFRAMETIME64_SO \
        vblank_mode=0 $frametime taskset 1 timeout 60 \
        "$benchmark" -NOSOUND -BENCHMARK $5 > /dev/null

        # read back the result, skip the first frames since they are the loading frames
        awk '{if (++n > 10) {print $2}}' /tmp/frametime.log | tee $2#$c | awk '{sum=sum+$1} END {print 1000000*NR/sum}'
    done
}

# 4 arguments: $rounds $fps_logs_file $runID $benchmark
__ue4:fullscreen__() {
    read width height <<< $(xdpyinfo | sed '/dimensions/!d; s/.*dimensions:\(.*\)x\(.*\) pixels.*/\1 \2/')
    __ue4__ "$1" "$2" "$3" "$4" "-ResX=$width -ResY=$height"
}

# 4 arguments: $rounds $fps_logs_file $runID $benchmark
__ue4:window__() {
    __ue4__ "$1" "$2" "$3" "$4" "-ResX=$UE4_WINDOW_SIZE_X -ResY=$UE4_WINDOW_SIZE_Y"
}

# 3 arguments: $rounds $fps_logs_file $runID
eval $(IFS= find "$UE4_FOLDER" -mindepth 1 -maxdepth 1 -type d | \
while read benchmark; do
    name=$(cat "$benchmark"/name 2>/dev/null || basename "$benchmark" | cut -f1 -d\  )
    echo "ue4:${name}:fullscreen_run() { __ue4:fullscreen__ \$1 \$2 \$3 \"\\\"$benchmark\\\"\"; };"
    echo "test_name=\"\$test_name ue4:${name}:fullscreen\";"
    echo "ue4:${name}:window_run() { __ue4:window__ \$1 \$2 \$3 \"\\\"$benchmark\\\"\"; };"
    echo "test_name=\"\$test_name ue4:${name}:window\";"
done; )

test_exec_time=120