check_hotswap_video.sh 1.5 KB

12345678910111213141516171819202122
  1. #!/usr/bin/env bash
  2. # Regression check for the grey-clouds bug: hotswapping from a scene that leaves glColorMask's alpha off (3471294034, cursor
  3. # particles) onto a video layer wallpaper (3818199837) left the video transparent. Renders the swap and a fresh start of the
  4. # target headlessly on the GPU (headless_render.sh) and compares the two pictures.
  5. # Usage: tools/check_hotswap_video.sh <engine binary> [assets dir] [workshop content dir]
  6. # Exit code 0 when the swapped picture looks like the fresh one. Needs Pillow (run with python3 -I).
  7. set -euo pipefail
  8. HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  9. BINARY=${1:?engine binary}
  10. ASSETS=${2:-/workspace/SteamLibrary/steamapps/common/wallpaper_engine/assets}
  11. CONTENT=${3:-/workspace/SteamLibrary/steamapps/workshop/content/431960}
  12. FROM=3471294034 TO=3818199837
  13. for id in $FROM $TO; do [ -d "$CONTENT/$id" ] || { echo "SKIP: wallpaper $id not in $CONTENT"; exit 0; }; done
  14. work=$(mktemp -d /tmp/lwe-hotswap-video.XXXXXX)
  15. trap 'rm -rf "$work"' EXIT
  16. echo "path=$CONTENT/$TO" > "$work/ctl"
  17. LWE_HOTSWAP_AT_FRAME=30 HEADLESS_RENDER_DELAY=300 "$HERE/headless_render.sh" "$BINARY" "$work/swap.png" \
  18. --assets-dir "$ASSETS" --control-file "$work/ctl" "$CONTENT/$FROM" > "$work/swap.log" 2>&1 || { cat "$work/swap.log"; exit 1; }
  19. HEADLESS_RENDER_DELAY=300 "$HERE/headless_render.sh" "$BINARY" "$work/fresh.png" \
  20. --assets-dir "$ASSETS" "$CONTENT/$TO" > "$work/fresh.log" 2>&1 || { cat "$work/fresh.log"; exit 1; }
  21. python3 -I "$HERE/linuxvm/check_frame.py" --similar "$work/fresh.png" "$work/swap.png" 10