Files
foxhound/scripts/play-foxhound.ps1
readmet3xt-lab 1be0981903 Fix input, loader, cache and smaller faults from the 0.8.3 review
Input and audio:
- Sony pads on raw HID are not read while an XInput pad is connected:
  behind a remapper (Steam Input, DS4Windows) the same pad was read
  twice, so remapped buttons still fired and rumble went twice.
  VICTORY_HID_BESIDE_XINPUT=1 reads both.
- Rumble for the one pad goes to the slots the last poll found, instead
  of asking every slot again under the input lock.
- VICTORY_DSP_PASS passes through mono convolutions only; stereo
  reverbs were passed as a five times louder dry copy.

Loader: a CLWB that cannot be replaced in place (it crosses a 16-byte
boundary, or VICTORY_PATCH_CLWB=0) goes to the crash module's handler,
which runs a whole write-back loop in one exception, instead of one
exception per cache line.

Pipelines and caches:
- The early-start list with runs goes to a file of its own; the plain
  list of keys is still written, so a 0.8.2 on the same cache folder
  finds its early pipelines again. The first start of this version on
  a folder counts as a first start, so the first-start hold applies.
- A pipeline library with no count file beside it (an earlier
  version's) is rebuilt once it is 64 MiB or more.
- The pipeline journal drops this process's notes when the run ends
  on purpose: a pipeline being made at exit was refused for good.
- `victory caches` keeps the folders of builds before the translator
  stamp, which 0.8.2 still reads, unless --older is given.
- The play script's prepare stamp includes the title profile's state,
  so a profile installed later translates again.

Logs and smaller fixes:
- Newer queues' methods 0xb8 and 0xc0, and the two device pipeline
  methods that are not implemented, are said once by what they are
  taken for; the repeated words lines stay in diagnostics builds.
- VICTORY_VIEW_SPLIT_ADAPTIVE leaves the per-draw tables their slots:
  its first sync raised the line over all of them, and every draw that
  needed a table was dropped.
- The STREAM_BOUND comment: a root view past its window reads whatever
  lies beyond, not zeros.
- The tiles test compiles its own shader with the run-time compiler; a
  debug build stopped on it as a shader not built with the crate.

Build and launcher:
- BCPack tests say when the format's own tables were not given, and
  fail with VICTORY_BCPACK_REQUIRE_TABLES=1; CI runs them where the
  repository variable VICTORY_BCPACK_TABLES names a file, and warns
  where it does not.
- The launcher asks Windows for AVX2 before a start: victory.exe is
  built for it and stops before its own check can say why.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 02:43:39 +05:30

146 lines
11 KiB
PowerShell

# Starts a program on foxhound with the settings tested on a 12 GB RTX card (Series X profile,
# 2560x1440 output, DLSS Quality when NVIDIA Streamline is set up).
#
# .\scripts\play-foxhound.ps1 -Exe 'D:\Games\MyCopy'
# .\scripts\play-foxhound.ps1 -Exe ... -Dlss off the program's own upscaling, no DLSS
# .\scripts\play-foxhound.ps1 -Exe ... -Dlss balanced -FrameGen
# .\scripts\play-foxhound.ps1 -Exe ... -SeriesS Series S profile (1280x720 inside, faster, softer)
# .\scripts\play-foxhound.ps1 -Exe ... -Build diag diagnostics build (slower; captures, timelines)
# .\scripts\play-foxhound.ps1 -Exe ... -More @{VICTORY_AMBIENT_SPECULAR='0'} add or override switches
# .\scripts\play-foxhound.ps1 -Exe ... -PrepareOnly translate shaders and compile pipelines, do not start
# .\scripts\play-foxhound.ps1 -Exe ... -NoPrepare start at once (the run compiles what is missing: stutter)
#
# Before the program starts, the launcher translates the program's shaders (a few minutes, once per build of foxhound
# and per set of switches) and compiles every pipeline earlier runs asked for (minutes after a new build or driver,
# seconds otherwise). Both use the very switches of the run: translations made with other switches are not found
# by the run, which then translates and compiles while you play.
#
# Build first (README). Run from a normal window, not as administrator. Each run writes a log to
# %LOCALAPPDATA%\victory\logs. Every VICTORY_... switch is described in a comment where the code reads it.
param(
[Parameter(Mandatory)][string]$Exe,
[ValidateSet('diag', 'release')][string]$Build = 'release',
[switch]$SeriesS,
# 1440: output and scene 2560x1440 (Series X, the image is patched); 3440: output and scene 3440x1440
# ultrawide (Series X, the image is patched); 1080to1440: scene 1920x1080 upscaled by the program;
# 4k: the stock Series X output (3840x2160).
# (0.8.3's 1200 is gone: no profile patches the output to 1920x1200.)
[ValidateSet('1440', '3440', '1080to1440', '4k')][string]$Res = '1440',
# DLSS Super Resolution in place of the program's upscaling; needs NVIDIA Streamline (README).
[ValidateSet('off', 'dlaa', 'quality', 'balanced', 'performance', 'ultraperformance')][string]$Dlss = 'balanced',
# DLSS Frame Generation (RTX 40 or later, hardware-accelerated GPU scheduling on); needs DLSS.
[switch]$FrameGen,
# Frames begin every 1/Fps s whatever the program asks (it asks 1/30); the frame time is the layer's limit.
[ValidateRange(1, 1000)][int]$Fps = 0,
[switch]$PrepareOnly,
[switch]$NoPrepare,
[hashtable]$More = @{}
)
$repo = Split-Path $PSScriptRoot -Parent
$settings = @{
# Submission and copy machinery
VICTORY_THIN = '1'; VICTORY_JOIN_PARTS = '8'; VICTORY_RELAY = '2'; VICTORY_RELAY_COPY = '1'; VICTORY_WIDE_BACK = '1'
VICTORY_CARD_REHASH_RUNS = '1'; VICTORY_JOIN_COPIES = '1'; VICTORY_CARD_STEPS = '2'; VICTORY_CARD_AWAKE = '1'
VICTORY_CARD_BUFFERS_MIN_KB = '64'; VICTORY_INDIRECT_WINDOW = '1'; VICTORY_INDIRECT_BATCH = '2'
VICTORY_UPLOAD_AHEAD = '1'; VICTORY_SHOW_AFTER = '1'; VICTORY_MAP_THREADS = '1'
# Shader writes into big write-combined copies stay on the card (-5 ms a frame)
VICTORY_WC_NO_BACK = '1'; VICTORY_WC_NO_BACK_MIN_KB = '1024'
# The program's page-mapping copies kept without Windows views (no heavy scene freezes at scene cuts)
VICTORY_SOFT_VIEWS = 'copies'
# Textures: pool with no blocks made ahead, no catch-up, levels not on demand (sharp); passes of 16 ms, the
# layer's own default again (0.8.3 set 24 here and in the launcher without an A/B)
VICTORY_TEXTURE_POOL = '1'; VICTORY_RIPE_BLOCKS = '0'; VICTORY_TEXTURE_NO_WAIT = '1'; VICTORY_TEXTURE_CATCHUP = '0'
VICTORY_LEVELS_ON_DEMAND = '0'
VICTORY_PRELUDE_UPLOADS = '1'; VICTORY_SHOW_NEW_LATER = '1'; VICTORY_POOL_SMALL = '0'; VICTORY_TABLED_REREAD = '1'
VICTORY_QUEUE_HOST_TEXTURES = '0'
# A frame's texture passes within 8 ms together; helpers woken at each submission's start (PR #13)
VICTORY_TEXSPK_PASS_MS = '8'; VICTORY_PASSES_HOT = '1'
VICTORY_SUBMIT_SPLIT = '1'; VICTORY_ASK_FIRST = '1'; VICTORY_OFF_LINE = '1'
# Write faults without the guards' lock (issue #8): the program's threads waited 13-17 ms a frame; 2-3 % faster
VICTORY_FAULT_UNLOCKED = '1'
# Stores into guarded memory done beside the guard; blocks written again and again left open for 50 ms
# (2026-11-28: waits for the guards 8.7 -> 2.5 ms a frame, changes of protection 14.3 -> 8.7 ms)
VICTORY_STORE_BESIDE = '1'; VICTORY_GUARD_HOT = '50'
# Descriptor heaps' records
VICTORY_HEAP_SYNC_FIRST = '1'; VICTORY_SYNC_IN_PLACE = '1'; VICTORY_SPANS_QUICK = '1'; VICTORY_SYNC_FINE = '1'
VICTORY_HEAP_SYNC_AT_SUBMIT = '1'
# The layer's own threads that a frame waits for run above normal priority (one run each: heavy scene frame time
# mean 37.2 -> 36.6 ms, worst second 74.8 -> 63.8, median unchanged)
VICTORY_HELPER_PRIORITY = '1'
# Light without the program's ray tracing: an estimate of indirect light and of reflections
VICTORY_AMBIENT = '0.8'; VICTORY_AMBIENT_AIR = '1.5'; VICTORY_AMBIENT_SPECULAR = '1'
# Pixel programs keep the console's early depth test
VICTORY_EARLY_DEPTH = '1'
# Pipelines the program makes are written down, so `victory warm` can make them ahead
VICTORY_PIPELINE_BOOK = '1'
# (KEEP_SHOWN, QUEUE_SNAPSHOT and PRESSURE_RELATIVE are no longer set here: the layer's defaults decide, as for
# the launcher. 0.8.3 set KEEP_SHOWN=2, QUEUE_SNAPSHOT=1 and, above 16 GB of RAM, PRESSURE_RELATIVE=1 together
# with 24 ms texture passes; the gain was measured for the four together, never one by one.)
}
if (-not $SeriesS) {
if ($Res -eq '1440') { $settings.VICTORY_NATIVE_1440P = '1' }
elseif ($Res -eq '3440') { $settings.VICTORY_NATIVE_ULTRAWIDE = '1' }
elseif ($Res -eq '1080to1440') { $settings.VICTORY_RENDER_1080P = '1' }
}
if ($Dlss -ne 'off') {
$sl = if ($env:VICTORY_STREAMLINE_DIR) { $env:VICTORY_STREAMLINE_DIR } else { 'C:\dev\sdk\streamline-sdk-v2.14.16\bin\x64' }
if (Test-Path (Join-Path $sl 'sl.interposer.dll')) {
$settings.VICTORY_DLSS = '1'; $settings.VICTORY_DLSS_MODE = $Dlss; $settings.VICTORY_STREAMLINE_DIR = $sl
if ($FrameGen) { $settings.VICTORY_FRAMEGEN = '1' }
} else {
Write-Host "No NVIDIA Streamline in $sl (set VICTORY_STREAMLINE_DIR, see README): running without DLSS."
}
}
if ($Fps -gt 0) { $settings.VICTORY_FRAME_INTERVAL_US = [string][int][math]::Round(1000000 / $Fps) }
foreach ($k in $More.Keys) { $settings[$k] = $More[$k] }
$console = if ($SeriesS) { 'series-s' } else { 'series-x' }
$victory = Join-Path $repo "target\$Build\victory.exe"
if (-not (Test-Path $victory)) { Write-Host "No $victory. Build it first (README)."; return }
if (-not (Test-Path -LiteralPath $Exe)) { Write-Host "No $Exe."; return }
# A folder in place of the executable: the one .exe in it (of several, the one whose name begins with 'game').
if (Test-Path -LiteralPath $Exe -PathType Container) {
$found = @(Get-ChildItem -LiteralPath $Exe -Filter *.exe -File)
if ($found.Count -gt 1) { $found = @($found | Where-Object Name -like 'game*') }
if ($found.Count -ne 1) { Write-Host "$Exe is a folder without one clear executable: give the program's .exe."; return }
$Exe = $found[0].FullName
}
# Switches left over in this window are cleared; path settings stay (victory.toml gives them otherwise).
$paths = 'VICTORY_CONFIG', 'VICTORY_GAME_DIR', 'VICTORY_CACHE_DIR', 'VICTORY_DATA_DIR', 'VICTORY_STREAMLINE_DIR'
Get-ChildItem Env:VICTORY_* -ErrorAction SilentlyContinue | Where-Object { $_.Name -notin $paths } | ForEach-Object { Remove-Item "Env:$($_.Name)" }
foreach ($k in $settings.Keys) { Set-Item "Env:$k" $settings[$k] }
$logs = Join-Path $env:LOCALAPPDATA 'victory\logs'; New-Item -ItemType Directory -Force $logs | Out-Null
if (-not $NoPrepare) {
# The tools cannot ask the card as a run does: NVIDIA and Intel cards run waves of 32 lanes, AMD cards the
# console's 64 (no setting). With several cards the run uses the fast one, which an NVIDIA card is taken to be.
$cards = @(Get-CimInstance Win32_VideoController -ErrorAction SilentlyContinue | ForEach-Object Name)
if ($cards -match 'NVIDIA' -or -not ($cards -match 'AMD|Radeon')) { $env:VICTORY_HOST_WAVE = '32' }
Push-Location $repo
try {
# Shaders: once per build and per set of switches (some change a translation; what is translated
# already is found again, so a needless pass costs half a minute).
$exeInfo = Get-Item $victory
# The title profile decides translations too: its state line (which profile, its tables and roles) is part
# of the stamp, so that a profile installed or changed later translates again.
$profileLine = @(& $victory title-profile status $Exe 2>$null | Where-Object { "$_" -like 'PROFILE *' }) -join ' '
$stamp = "$($exeInfo.Length) $($exeInfo.LastWriteTimeUtc.Ticks) $env:VICTORY_HOST_WAVE $profileLine " + (($settings.GetEnumerator() | Sort-Object Name | ForEach-Object { "$($_.Name)=$($_.Value)" }) -join ' ')
$stampFile = Join-Path $env:LOCALAPPDATA "victory\prepared-$Build.txt"
if ((Get-Content $stampFile -Raw -ErrorAction SilentlyContinue) -ne $stamp) {
Write-Host 'Translating the program''s shaders (once per build: a few minutes, up to 15 on a first install; it uses the processor, not the card)...'
& $victory shaders (Split-Path -Parent $Exe) 2>&1 | ForEach-Object { $l = "$_"; if ($l -match '^\d+ shaders in the cache') { Write-Host " $l" } elseif ($l -notmatch '^\d{4}-\d\d-\d\dT') { $l } } | Select-Object -Last 3
if ($LASTEXITCODE -eq 0) { [IO.File]::WriteAllText($stampFile, $stamp) }
}
Write-Host 'Compiling the pipelines earlier runs asked for (seconds, or minutes after a new build or driver)...'
& $victory warm 2>&1 | ForEach-Object { $l = "$_"; if ($l -match '^\d+ of \d+') { Write-Host " $l" } elseif ($l -notmatch '^\d{4}-\d\d-\d\dT') { $l } } | Select-Object -Last 2
} finally { Pop-Location; Remove-Item Env:VICTORY_HOST_WAVE -ErrorAction SilentlyContinue }
}
if ($PrepareOnly) { return }
$log = Join-Path $logs ('foxhound-{0:yyyyMMdd-HHmmss}.log' -f (Get-Date))
$writer = [IO.StreamWriter]::new($log, $false, [Text.UTF8Encoding]::new($false)); $writer.AutoFlush = $true
$writer.WriteLine("# console=$console build=$Build switches: " + (($settings.GetEnumerator() | Sort-Object Name | ForEach-Object { "$($_.Name)=$($_.Value)" }) -join ' '))
Write-Host "Log: $log"
Push-Location $repo # victory.toml is read from here
try { & $victory run $Exe --console $console --execute 2>&1 | ForEach-Object { $line = "$_"; $writer.WriteLine($line); $line } }
finally { Pop-Location; $writer.Dispose() }