render_ours.sh 2.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/bash
  2. # usage: render_ours.sh <outdir> [ids...] (default: every scene/preset item in the scan.py database)
  3. # headless GPU render at WE's window size (1920x1058), frame 600 @30fps -> <outdir>/<id>.png + .log
  4. # LWE=<dir with linux-wallpaperengine + its lib .so> picks the build (default: this checkout's build/output)
  5. # audio goes to dead sockets: the engine captures from the desktop's audio server even with --silent
  6. W=${LWE_WORKSHOP_DIR:-/workspace/SteamLibrary/steamapps/workshop/content/431960}
  7. A=${LWE_ASSETS_DIR:-/workspace/SteamLibrary/steamapps/common/wallpaper_engine/assets}
  8. LIB=${LWE_LIBRARY_DIR:-$HOME/.local/share/lwe-library}
  9. SRC=$(cd "$(dirname "$0")/../.." && pwd)
  10. LWE=${LWE:-$SRC/build/output}
  11. OUT=$1; shift; mkdir -p "$OUT"
  12. # a copy under another name so we_manager's shutdown pkill doesn't hit it
  13. cp -f $LWE/linux-wallpaperengine $LWE/lwe-regress-bin
  14. # web and video wallpapers can't be compared (see README) and only add CEF/mpv crashes, ALL_TYPES=1 keeps them
  15. ids=("$@"); [ ${#ids[@]} -eq 0 ] && ids=($(python3 -c "
  16. import json, os
  17. items = json.load(open('$LIB/features.json'))
  18. keep = os.environ.get('ALL_TYPES') == '1'
  19. print(' '.join(sorted(i for i, v in items.items() if keep or v['info'].get('type') not in ('web', 'video'))))"))
  20. # renders are paced at 30 fps (600 frames = 20 s of wall clock each), so they run JOBS at a time (default 6).
  21. # headless_render.sh gives every render its own runtime dir; its D-Bus shim is built once up front
  22. [ -f /tmp/dbus_noop_shim.so ] || gcc -shared -fPIC -o /tmp/dbus_noop_shim.so $SRC/tools/dbus_noop_shim.c -ldl
  23. # WE's pointer on :98 (960,540 = window 956,510), fractions from the bottom
  24. export LWE_HEADLESS_CURSOR=${LWE_HEADLESS_CURSOR:-0.4990,0.5143}
  25. render_one() {
  26. local id=$1
  27. PULSE_SERVER=unix:/nonexistent-pulse PIPEWIRE_REMOTE=/nonexistent-pipewire \
  28. HEADLESS_RENDER_SIZE=1920x1058 HEADLESS_RENDER_DELAY=${DELAY:-600} HEADLESS_RENDER_TIMEOUT=90 LD_LIBRARY_PATH=$LWE${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} \
  29. $SRC/tools/headless_render.sh $LWE/lwe-regress-bin "$OUT/$id.png" --assets-dir $A --fps 30 --silent $W/$id > "$OUT/$id.log" 2>&1 < /dev/null
  30. echo "ours $id rc=$? $( [ -f "$OUT/$id.png" ] && echo ok || echo NO-PNG)"
  31. }
  32. export -f render_one
  33. export SRC LWE OUT A W DELAY
  34. printf '%s\n' "${ids[@]}" | xargs -P "${JOBS:-6}" -I{} bash -c 'render_one {}'