README, findings and a start script of this fork; fxceless' README kept in docs; the translator's file may be 640 KiB
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
7e945ed582
commit
1028eef2c8
6 files changed
+593
-324
No files matched your search
@@ -1,332 +1,115 @@
|
||||
# VIctory fork (work in progress)
|
||||
# VIctory on an RX 7900 XTX
|
||||
|
||||
A work-in-progress fork of [VIctory](https://github.com/Marvisak/VIctory), a
|
||||
compatibility layer that runs an Xbox Series title natively on Windows from
|
||||
files the user supplies. This fork follows upstream
|
||||
`main` and adds fixes aimed at one goal: getting the game's world to render
|
||||
correctly and playably on one particular PC.
|
||||
A fork of [VIctory](https://github.com/Marvisak/VIctory), a compatibility layer
|
||||
that runs an Xbox Series title natively on Windows from files the user supplies.
|
||||
This one is about **speed on AMD RDNA 3**: the world at 30 frames a second on
|
||||
one PC, without giving up the picture. It is not there yet.
|
||||
|
||||
**This repository contains no game files, code or assets.** You need your own
|
||||
copy of the game. It is not affiliated with or endorsed by the game's
|
||||
developer or publisher.
|
||||
copy of the game. It is not affiliated with or endorsed by the game's developer
|
||||
or publisher.
|
||||
|
||||
## Where it stands (2026-11-25)
|
||||
|
||||
Tested on one machine only: Windows 11, Intel i9-12900K, 64 GB RAM, Radeon
|
||||
RX 7900 XTX, 1440p, the Series X profile.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Menus, videos, loading screens | 30 fps |
|
||||
| Prologue, indoors | 50-75 ms a frame (13-20 fps) |
|
||||
| First mission with the boat | 46-53 ms (19-22 fps) |
|
||||
| Street chase with many cars and people | 100-165 ms (6-10 fps), single frames far longer |
|
||||
| Outdoors on foot, the camp | 60-90 ms |
|
||||
| Flying | 42-57 ms |
|
||||
| Longest session so far | 41 minutes, no crash |
|
||||
| Memory | 40-46 GB of private memory: **64 GB of RAM recommended** |
|
||||
|
||||
It started at 280 ms a frame in the same scenes two days earlier.
|
||||
|
||||
What is known to be wrong:
|
||||
|
||||
- Trees, plants and far buildings flicker outdoors in some places.
|
||||
- Rooms with little direct light are too dark without `-RayTracing`.
|
||||
- Textures of what just came into view appear late while the title streams.
|
||||
- The first run with a new driver or a new build stutters while the driver makes
|
||||
pipelines (`victory warm` makes them ahead).
|
||||
- Recording a frame in the world makes the title's own watchdog end it.
|
||||
|
||||
## How to run it
|
||||
|
||||
You need Windows 10/11 x64, a CPU with AVX2, a Direct3D 12 GPU with shader
|
||||
model 6.6 and mesh shaders, Rust (the toolchain is pinned), the MSVC build
|
||||
tools, and your own dump of the title.
|
||||
|
||||
```powershell
|
||||
git clone <this repository>
|
||||
cd <the folder>
|
||||
copy victory.example.toml victory.toml # then set your paths, outside this folder
|
||||
cargo build --locked --profile diag -p victory --features diagnostics
|
||||
scripts\play.ps1 -Exe <path of your copy's executable>
|
||||
```
|
||||
|
||||
`scripts\play.ps1 -Safe` leaves out the newest, faster ways; try it first when
|
||||
something is wrong. `-RayTracing` turns the title's ray-traced indirect light on.
|
||||
|
||||
Before the first run, ahead of time (both can be stopped and go on later):
|
||||
|
||||
```powershell
|
||||
target\diag\victory.exe shaders <the shader archives> # every shader translated, minutes
|
||||
target\diag\victory.exe warm --used # pipelines earlier runs drew with, for a new driver or build
|
||||
```
|
||||
|
||||
Commands, debugging switches and upstream's own description:
|
||||
[docs/README-fxceless.md](docs/README-fxceless.md). Every `VICTORY_...` switch is
|
||||
described in a comment where it is read.
|
||||
|
||||
## What is different here
|
||||
|
||||
In short; the reasons and the measurements are in [docs/findings.md](docs/findings.md).
|
||||
|
||||
- **List calls are written down, not carried out, on the title's threads**
|
||||
(`VICTORY_THIN`): eight threads of ours translate them.
|
||||
- **Submissions are prepared by a thread of ours and joined**
|
||||
(`VICTORY_ASYNC_SUBMIT`, `VICTORY_JOIN_PARTS`), with what can be spread over
|
||||
threads spread: refreshes, compares (AVX2), descriptor records, landings.
|
||||
- **What shaders wrote comes back beside the write guards**, by the dwords that
|
||||
changed, on a thread of its own (`VICTORY_RELAY`, `VICTORY_LAND`).
|
||||
- **Buffer fills that need bytes still on the card are done on the card**
|
||||
(`VICTORY_CARD_STEPS`) instead of waiting for it.
|
||||
- **The title's writes are caught more cheaply**: one view opened at a fault,
|
||||
blocks that rest, places in the title's code that look before they write.
|
||||
- **Textures go up on a copy queue of their own** and a slot shows one only after
|
||||
its upload ran, which also ended a device loss that came every 15 minutes or so.
|
||||
- **Boats float**: textures that shaders write and the title's CPU reads go back
|
||||
to title memory (from fxceless and Geckomacabre, on by default here).
|
||||
- **Frame record and replay** with per-pass times and shader variants compared
|
||||
turn by turn ([docs/replay.md](docs/replay.md)).
|
||||
|
||||
## Credits
|
||||
|
||||
This is a tree of other people's work with more on top. The history is kept, and
|
||||
commits taken from elsewhere name the commit and its author.
|
||||
|
||||
- **[VIctory](https://github.com/Marvisak/VIctory)** by Marvisak and its
|
||||
contributors is the base of everything here: the loader, the runtime
|
||||
services, the Direct3D 12 back end and the shader recompiler. Licensed
|
||||
GPL-3.0-or-later; so is this fork. Upstream's history is kept intact below
|
||||
the single commit that carries this fork's changes.
|
||||
- **[XCL](https://github.com/ivall/xcl)** by ivall and its contributors
|
||||
(GPL-2.0-only) was used as a reference for how the same title behaves under
|
||||
another layer. Fixes inspired by it were written anew in VIctory's code.
|
||||
- The guard over every view of a memory page is code by **myokex**
|
||||
([victory-amd](https://github.com/myokex/victory-amd), commit `c6dc4d8`), which
|
||||
adapts pull request #115 here by Spexivus, its correction by joroyt and a part of
|
||||
VIctory #1122 by tightfall. The read-beside fix for kernel reads into title
|
||||
memory is by **Joshua Odom** (commit `10ea38e` of the same fork family). Both
|
||||
are carried here unchanged apart from one merge conflict.
|
||||
- This fork's changes were developed with [Claude Code](https://claude.com/claude-code).
|
||||
|
||||
## Status of this fork (2026-11-25)
|
||||
|
||||
**Not playable yet: 2.5 to 4 frames per second, and shadowed areas are black.**
|
||||
Tested on one machine: Windows 11, Intel i7-14700KF, NVIDIA RTX 4070 12 GB,
|
||||
32 GB RAM. The Series X profile is used throughout.
|
||||
|
||||
| Stage | State in this fork |
|
||||
|-------|--------------------|
|
||||
| Boot, menus, start screen | works, 30 fps (as upstream) |
|
||||
| Opening cutscene | plays from start to finish, in order, lit: title cards, credits cards, night and dusk shots |
|
||||
| Saves | the game autosaves a checkpoint and loads it again |
|
||||
| First gameplay scene (the prologue) | renders: characters, textures, sky, sunlit exterior; HUD, pause menu and pad input work |
|
||||
| Light in shadow | missing: the game's ray-traced bounce light and ray-traced lamp and sun shadows do not run yet, so anything the sun does not hit directly is black |
|
||||
| Frame rate in the world | 2-4 fps: 420-450 ms per frame by default, 240-350 ms with the newer switches (`VICTORY_RELAY=2`, or `VICTORY_LATE_WAIT=3 VICTORY_WIDE_BACK=1 VICTORY_CARD_BUFFERS_MIN_MB=1 VICTORY_CARD_BUFFERS_MB=1024`); it started at 3-6 seconds per frame |
|
||||
| Stability | no driver hang or device loss in normal runs (a hang introduced by the wave64 update was found and fixed: its barrier form for 64-lane programs is now off unless `VICTORY_WAVE_WIDE=1`) |
|
||||
|
||||
### Newest (2026-11-25, later the same day)
|
||||
|
||||
**Update, the same night: the first room now renders right on the test
|
||||
machine** (walls, textures, people, lamps), at 190 to 450 ms a frame (2 to 5
|
||||
frames a second): the picture work has caught up, the frame rate has not.
|
||||
What did it, on top of the list below:
|
||||
- Descriptor records the title copies into its heap as plain bytes are
|
||||
mirrored before every submission (pull request #305 by Flyander, after
|
||||
upstream VIctory 86a5ed6). Measured here: about 40,000 records a frame
|
||||
that no call had announced; their host slots were empty or stale.
|
||||
- A buffer view that does not start on an element of its buffer's host
|
||||
copy gets a copy of its own bytes instead of being refused (after
|
||||
upstream 86a5ed6): 3 to 6 such views a frame.
|
||||
- Room on the card is kept for the render targets and buffer copies a
|
||||
world makes in its first frame: 98 buffer copies are made (945 MB) where
|
||||
the runs before made 1, and the processor no longer compares 550 to
|
||||
710 MB a frame looking for shader writes (25 MB now).
|
||||
- Levels on demand ran on the card for the first time
|
||||
(`VICTORY_LEVELS_ON_DEMAND=1`, still off by default; with the fixes of
|
||||
pull request #747 by AscilCH): 3.1 GB of the card not allocated for
|
||||
texture levels the title does not hold, no device loss.
|
||||
- Guarded blocks under storage writes are opened by default; 14 more
|
||||
shader programs translate; a program is translated with first-half
|
||||
interpolation pairs only if it was refused for one (with that on for
|
||||
every program, 8,551 working pixel programs came out changed).
|
||||
- Known and counted, not fixed yet: an indirect compute pass asks for
|
||||
about 77,500 thread groups in x where one dispatch runs 65,535 (the
|
||||
rest is cut off).
|
||||
|
||||
Memory sync between the title's memory and the copies on the card:
|
||||
- **A write through one view of a physical page is seen by the copies taken
|
||||
through its other views** (`VICTORY_VIEW_GUARD=0` turns it off). The title
|
||||
shows one page at several addresses and a copy was guarded at one of them
|
||||
only. Measured on the test machine: 0.8 to 1.0 million such writes in a
|
||||
five-minute run, every one of which used to leave a copy stale. Since it
|
||||
went in, the first room had its walls in the later frames of 4 runs out of
|
||||
4 (2 of 5 before); the room's very first shot still comes up without walls
|
||||
in some runs.
|
||||
- Kernel reads into title memory are read beside and copied in, so a block
|
||||
guarded again in between no longer fails the read.
|
||||
- Writes of the storage layer into physical pages are counted where the title
|
||||
has those pages mapped (10,000 to 50,000 guarded blocks of copies lay under
|
||||
them in every run) and can open the guards there:
|
||||
`VICTORY_PAGE_WRITES=guards` (off by default; `1`, `slots`, `all` do more).
|
||||
- Failed page-destination reads are retried (`VICTORY_DSTORAGE_RETRIES=0` = as before).
|
||||
|
||||
Card memory (the test card is full from the first frame of the world: 85 to
|
||||
99 % of its budget for a whole run, about 26,000 texture copies let go and
|
||||
3,400 made again in five minutes, 2.8 GB of render targets that are all in
|
||||
use):
|
||||
- Levels on demand, **off by default** (`VICTORY_LEVELS_ON_DEMAND=1`): a
|
||||
texture the title fills takes card memory only for the levels the title
|
||||
holds (2.2 to 3.0 GB of the copies were levels it does not hold). Its test
|
||||
runs on the software adapter; it has not run on a card yet.
|
||||
- Refused texture slots are held back for a few seconds so that a pass
|
||||
reaches the slots behind them (`VICTORY_FULL_CARD_PASS=0` = as before);
|
||||
room can be kept for the card copies of title buffers
|
||||
(`VICTORY_CARD_ROOM_FOR_BUFFERS=1`, off).
|
||||
|
||||
Tools and diagnostics:
|
||||
- `victory translate <shader file> --warm all --jobs N` translates every
|
||||
shader ahead of a run, on the processor only (about 4.5 to 6.5 minutes
|
||||
here); the shader cache is keyed on the translator's source, so a new
|
||||
build that does not touch the translator starts warm.
|
||||
- Counters, all off or diagnostics-only: `VICTORY_MERGE_RACE=1` (title bytes
|
||||
a copy-back is about to put back to older values: none found in 138,000
|
||||
copy-backs), `VICTORY_WALLS_TRACE`, `VICTORY_CARD_ACCOUNTING`, and a census
|
||||
of the copies the texture sweep never lets go.
|
||||
|
||||
### What this fork changed (summary)
|
||||
|
||||
Rendering:
|
||||
- Meshlet culling read its scene buffers as the wrong kind of view, so the world drew almost nothing; fixed.
|
||||
- Per-draw descriptor tables could run out, after which draws used slots never made for them and the card hung; fixed.
|
||||
- Light packed by the game's compute shaders was read back through empty copies (sky, probes, fog); fixed for every mip level and layer.
|
||||
- The fog reconstruction, shadow-mask, hair, blend-shape skinning, fire and several material programs did not translate; fixed.
|
||||
- Gathers at a named mip level (with and without an offset) read level 0; fixed.
|
||||
- Implicit-level samples outside pixel shaders produced invalid DXIL in 730 compute programs; fixed.
|
||||
- Rectangle lists, depth and stencil twins for depth textures written by compute, texture read-backs.
|
||||
- Ray tracing, in progress and off by default: the game's own structure-builder programs translate, title memory can be read by raw address from shaders, the hardware ray/box and ray/triangle test is emulated in DXIL (checked against a reference on the GPU), and 59 of the 64 trace programs translate. Nothing is lit by it yet. See [docs/fork-ray-tracing.md](docs/fork-ray-tracing.md).
|
||||
|
||||
Speed and memory:
|
||||
- Waits for memory values, write-watch queries and page queries no longer walk page tables per call.
|
||||
- Large title buffers get a copy in card memory, with shader writes found by hashing on the card.
|
||||
- Submissions can be sent ahead of the wait for the card (`VICTORY_LATE_WAIT`), with a relay thread that lands results as the card finishes (`VICTORY_RELAY`): in a first five-minute run the card's idle time behind the submitting thread fell from about 136 to 30 ms per frame.
|
||||
- Independent host-copy refreshes run in parallel by default on systems with at least four logical CPUs (`VICTORY_WIDE_REFRESH=0` disables this; `=1` forces it). This targets the serial memory reads that previously cost about 45–50 ms per frame on the test run.
|
||||
- Title memory can be opened as a graphics heap so that buffers are used in place instead of copied (`VICTORY_INPLACE`, first stage only; a probe confirmed the approach on the test GPU).
|
||||
- The bindless texture queue no longer uploads stale views; the view table no longer grows without bound; the pipeline library is mapped instead of read into memory.
|
||||
- An intermittent device loss was traced to the pipeline library file being replaced while mapped; fixed.
|
||||
|
||||
- Translated shaders get clean-up passes over the finished module (dead code, constant folding, reuse of values, branch facts); the pack's host instruction count falls by about 43 %, worth about 20 ms of GPU time per frame on the test machine (`VICTORY_SHADER_OPT=0` turns them off).
|
||||
|
||||
Most of the newer speed changes sit behind environment switches that are off
|
||||
by default (`VICTORY_LATE_WAIT`, `VICTORY_RELAY`, `VICTORY_WIDE_BACK`,
|
||||
`VICTORY_CARD_BUFFERS_MIN_MB`, `VICTORY_INPLACE`, `VICTORY_BVH_BUILDER`, ...).
|
||||
Independent host-copy refreshes are the exception: they use parallel workers
|
||||
automatically on systems with at least four logical CPUs. Each switch is
|
||||
described in a comment where it is read.
|
||||
|
||||
### Known problems
|
||||
|
||||
- Everything in shadow is black (see above).
|
||||
- The interior of the first gameplay room is sometimes not drawn after the cutscene hands over to gameplay.
|
||||
- Around 24 GB of memory is in use during play.
|
||||
- A few style lints are switched off for this fork in the workspace `Cargo.toml` until the newer code is tidied.
|
||||
- Many changes here are specific to this title and this GPU, and some are marked `shortcut:` in the code where they approximate what the console does.
|
||||
|
||||
Everything below this line is upstream VIctory's own README, unchanged; its
|
||||
status section describes upstream, not this fork.
|
||||
|
||||
---
|
||||
|
||||
# VIctory
|
||||
|
||||
Runs the title (Xbox Series X|S) natively on Windows, from files
|
||||
the user supplies.
|
||||
|
||||
The title's x86-64 code runs unchanged inside our process; VIctory supplies
|
||||
the platform underneath it and converts the title's data, ahead of time where
|
||||
it can (shaders and pipelines too, see Getting started) and on first use
|
||||
otherwise. See [docs/architecture.md](docs/architecture.md).
|
||||
|
||||
## Status (2026-11-24)
|
||||
|
||||
**Not playable yet.** The title boots, runs its menus at its own 30 fps,
|
||||
loads the world and shows it: slowly, and with rendering defects.
|
||||
|
||||
| Stage | State |
|
||||
|-------|-------|
|
||||
| Boot, first-boot screens (accessibility, language, settings, legal) | works, 30 fps |
|
||||
| Intro video with sound | works |
|
||||
| Start screen, profile and saves | works |
|
||||
| Loading into the world (about 50 s) | works |
|
||||
| The world (first mission's intro) | drawn and shown: streets, buildings, vehicles, characters, the title card and credits; 1-2 s per frame. Surfaces are unlit, a band of distant geometry is missing, characters come out broken in some shots |
|
||||
|
||||
Tested on one machine: Windows 11, AMD RX 6700 XT.
|
||||
|
||||
> **Warning.** Entering the world on a real GPU has hung it in earlier
|
||||
> builds, and Windows then resets the display driver (every monitor goes
|
||||
> black for a moment). The latest runs did not, but it is not ruled out; a
|
||||
> run can also end on a GPU fault (`crashes.log`). A diagnostics build with
|
||||
> `VICTORY_D3D12_WARP=1` renders on the software adapter instead (too slow
|
||||
> to reach the world in minutes).
|
||||
|
||||
What each part does today and what it still needs:
|
||||
|
||||
| Subsystem | Today | Needs |
|
||||
|-----------|-------|-------|
|
||||
| Loader | Runs the title's executable and its DLLs in our process; crash reports name the faulting code and are kept in `crashes.log` | – |
|
||||
| Runtime services | One signed-in offline user, licences, packages, saves that survive a kill at any step, text entry dialog | Speech is silent; the dialog and relaunch are untested live |
|
||||
| Network | Offline by design: the title cannot reach the network | – |
|
||||
| Files and streaming | Archives and streamed data read, zlib and BCPack decoded in parallel | Loading is limited by writes into title memory |
|
||||
| Input | XInput pads, keyboard, keyboard stand-in pad | Trigger rumble |
|
||||
| Audio | Menu, video and loading sound; XMA voices and Opus streams decode | Reverb is silent; Opus results unverified against the title |
|
||||
| GPU: menus | Draws, compute and presentation on host D3D12; only changed title memory is copied | Frame pacing drifts on one screen in release builds |
|
||||
| GPU: world | The scene is drawn and presented: mesh pipelines, indirect execution, views the shaders pick from the heap themselves, title memory read by address (ray-tracing structures), depth written from compute, pipelines pre-built or made by worker threads and kept on disk | Lighting (surfaces are unlit) and some missing geometry; frames take 1-2 s; draws of untranslated shaders are dropped; real queries, depth bounds, HDR and scaling are missing |
|
||||
| Shaders | Console GPU code recompiled to DXIL, ahead of time (`translate --cache`) or at first use, cached on disk. Menus: all. World: mesh 8,765 of 8,765, vertex/pixel 12,550 of 12,592, compute 2,579 of 2,637 | Merged geometry stages (195 programs) and about 100 others; fused multiply-adds follow the host GPU; some compute programs need a GPU with 64-lane waves |
|
||||
| Textures | Console tiled layouts and detiling for the modes the title uses | Render-target metadata planes |
|
||||
| Series S mode | Runs through the menus to the loading screen | The world, as above |
|
||||
|
||||
## Getting started
|
||||
|
||||
Requirements: Windows 10/11 x64, a CPU with AVX2, a Direct3D 12 GPU with
|
||||
shader model 6.6 (and mesh shaders for the world), Rust (pinned in
|
||||
`rust-toolchain.toml`).
|
||||
|
||||
To install Rust, use rustup (`winget install --id Rustlang.Rustup -e`, or
|
||||
the installer from https://rustup.rs). The first `cargo` command in this
|
||||
repository then fetches the pinned toolchain. Building needs the MSVC C++
|
||||
build tools: Visual Studio or its Build Tools with the "Desktop development
|
||||
with C++" workload.
|
||||
|
||||
The title also needs several GiB of available Windows commit at startup.
|
||||
Check **Committed** under **Task Manager → Performance → Memory**. If
|
||||
`crashes.log` reports Windows error 1455, close other applications or increase
|
||||
the Windows paging file size, then retry.
|
||||
|
||||
```powershell
|
||||
cargo xtask install-hooks # asset-policy check on every commit
|
||||
copy victory.example.toml victory.toml # then set your paths (outside the repo)
|
||||
cargo test --workspace # needs no game data
|
||||
cargo run -p victory -- config # check your paths
|
||||
```
|
||||
|
||||
Run the title:
|
||||
|
||||
```powershell
|
||||
cargo build --release -p victory
|
||||
target\release\victory.exe run <game dir>\<the title's exe> --execute
|
||||
```
|
||||
|
||||
The window caption shows the framerate. Saves, settings and `crashes.log`
|
||||
are kept under the data folder (default `%LOCALAPPDATA%\victory\data`), derived
|
||||
data under the cache folder.
|
||||
|
||||
Set `VICTORY_WINDOW_MAX=1920x1080` before launching to limit the title's
|
||||
top-level window to that bounding box. Smaller windows keep their size,
|
||||
larger windows keep their proportions, and the monitor's work area still
|
||||
limits them. This scales the displayed image; it does not change the
|
||||
console render resolution or the swap-chain buffers. With the variable
|
||||
unset, window sizing is unchanged.
|
||||
|
||||
Input: XInput pads. With none connected the keyboard is a pad while the
|
||||
title's window has focus:
|
||||
|
||||
| Keys | Pad |
|
||||
|------|-----|
|
||||
| W A S D / I J K L | left / right stick |
|
||||
| arrows | D-pad |
|
||||
| Enter, Backspace, X, Y | A, B, X, Y |
|
||||
| Q / E, Z / C | shoulders, triggers |
|
||||
| F / H | stick clicks |
|
||||
| Esc, Tab | Menu, View |
|
||||
|
||||
## Commands
|
||||
|
||||
```
|
||||
victory inspect <exe|dll> [--imports] [--exports]
|
||||
victory census [paths...] [--missing] [--strict]
|
||||
victory lib-exports <import.lib> [--list]
|
||||
victory shader-info [paths...] [--verbose] [--disasm]
|
||||
victory translate [paths...] [--validate] [--pipelines] [--list] [--jobs N]
|
||||
victory run <exe> [--execute] [--unimplemented trap|zero] [--strict]
|
||||
[--console series-x|series-s] [-- <title arguments>]
|
||||
victory config
|
||||
```
|
||||
|
||||
Logging: `VICTORY_LOG=victory_loader=trace,info` (a release build logs
|
||||
info and above).
|
||||
|
||||
### Windows shader-test validator
|
||||
|
||||
The shader tests use `dxil.dll` to validate Shader Model 6.6 containers.
|
||||
An older Windows SDK validator can load successfully but reject them with
|
||||
`Unknown shader model 'ps_6_6'`. If this happens, use a current x64 validator
|
||||
from [Microsoft's DirectX Shader Compiler releases](https://github.com/microsoft/DirectXShaderCompiler/releases)
|
||||
or a current Windows SDK. Set its path for the test session:
|
||||
|
||||
```powershell
|
||||
$env:VICTORY_DXIL = 'C:\tools\dxc\bin\x64\dxil.dll'
|
||||
cargo test -p victory-shader --lib --locked -- --test-threads=1
|
||||
```
|
||||
|
||||
Without this override, the validator loader selects the newest installed
|
||||
Windows SDK's `bin/<version>/x64/dxil.dll`, then falls back to the DLL search
|
||||
path when no SDK copy is found. This is a test/offline-validation dependency;
|
||||
the translated shaders do not require it at runtime.
|
||||
|
||||
## Debugging
|
||||
|
||||
A release build has no debugging aids. Build them in with
|
||||
|
||||
```powershell
|
||||
cargo build --profile diag -p victory --features diagnostics # target\diag\victory.exe
|
||||
```
|
||||
|
||||
The on/off switches below (`...=1`) are off when unset or set to `0`.
|
||||
|
||||
| Variable | Effect |
|
||||
|----------|--------|
|
||||
| `VICTORY_LOG=<target>=debug,...` | debug and trace output |
|
||||
| `VICTORY_STACKS=20,60` | every thread's stack at those seconds |
|
||||
| `VICTORY_WATCH=<rva>,...` | logs a title u32 when it changes |
|
||||
| `VICTORY_POKE=<rva>:<byte>,...` | writes a title byte twice a second (a hang watchdog's tick, say) |
|
||||
| `VICTORY_KEYS=30:Enter,35:X` | presses keys at those seconds, focus or not |
|
||||
| `VICTORY_CRASH_SAVE=<rva>:<len>,...` | saves title memory to the cache folder on a crash |
|
||||
| `VICTORY_CAPTURE=<dir>` | saves presented frames (powers of two, or `VICTORY_CAPTURE_FRAMES=<list>`) |
|
||||
| `VICTORY_DUMP_TARGETS=1` | with the two above, saves every render target of those frames |
|
||||
| `VICTORY_D3D12_DEBUG=1` | host debug layer |
|
||||
| `VICTORY_D3D12_GBV=1` | with the above, GPU-based validation (bad descriptor use reported, not faulted; slow) |
|
||||
| `VICTORY_D3D12_DRED=1` | on a GPU failure, the allocation hit and the commands in flight |
|
||||
| `VICTORY_PIPELINE_WAIT_MS=24` | reduce the per-frame wait for background pipeline creation from the default of 500 ms. A draw can be omitted until its pipeline is ready |
|
||||
| `VICTORY_SKIP_PIPELINES=<hash>,...` | omit draws and dispatches, including indirect ones, whose pipeline contains a listed 16-digit shader hash |
|
||||
| `VICTORY_GPU_TIMING=1` | with the above, each list of a submission run and timed on its own; slow lists logged with their slowest commands |
|
||||
| `VICTORY_D3D12_WARP=1` | host device on the software adapter (slow; cannot reset the driver) |
|
||||
| `VICTORY_SHADER_LOOP_LIMIT=<n>` | translated shader loops stop after `n` iterations per lane instead of 2^20 (own shader cache entries); if a lower `n` makes world frames much faster, loops hitting the limit are what makes them slow |
|
||||
| `VICTORY_AUDIO_CAPTURE=<file.wav>` | records what the title plays (our process only) |
|
||||
| `VICTORY_XMA_DUMP=<dir>` | saves the first 32 XMA voices' context and input |
|
||||
|
||||
Every build appends crashes and host GPU failures to `crashes.log` in the
|
||||
title's data folder.
|
||||
contributors: the loader, the runtime services, the Direct3D 12 back end and
|
||||
the shader recompiler.
|
||||
- **[fxceless/victory-fork](https://github.com/fxceless/victory-fork)**: the fork
|
||||
this one started from, and the people whose pull requests it carries.
|
||||
- **[DexNom/VIctory](https://github.com/DexNom/VIctory)**: ray tracing fixes,
|
||||
cube gradients, sparse textures.
|
||||
- **[Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD)**:
|
||||
the ambient light idea, pipeline workers, and work by romainhedouin.
|
||||
- **[FQY55kai/ZJOU-VICTORY](https://github.com/FQY55kai/ZJOU-VICTORY)**.
|
||||
- **[myokex/victory-amd](https://github.com/myokex/victory-amd)**: the guard over
|
||||
every view of a page (with Spexivus, joroyt and tightfall), and Joshua Odom's
|
||||
reads into title memory.
|
||||
- **Geckomacabre** and **cxy0072019-sketch**: the texture read-back.
|
||||
- **[XCL](https://github.com/ivall/xcl)** (GPL-2.0-only) was read for how the same
|
||||
title behaves under another layer; no code of it is here.
|
||||
- This fork's changes were made with [Claude Code](https://claude.com/claude-code).
|
||||
|
||||
## License
|
||||
|
||||
GPL-3.0-or-later. See [LICENSE](LICENSE).
|
||||
|
||||
GPL-3.0-or-later, as VIctory. See [LICENSE](LICENSE); the one file that is not
|
||||
covered is named in [docs/asset-policy.md](docs/asset-policy.md).
|
||||
@@ -0,0 +1,336 @@
|
||||
> This is the README of fxceless/victory-fork as this fork had it, kept for its
|
||||
> description of upstream, the commands and the debugging switches. What it says of
|
||||
> speed and state is of that fork and another PC; this fork: [README](../README.md).
|
||||
|
||||
# VIctory fork (work in progress)
|
||||
|
||||
A work-in-progress fork of [VIctory](https://github.com/Marvisak/VIctory), a
|
||||
compatibility layer that runs an Xbox Series title natively on Windows from
|
||||
files the user supplies. This fork follows upstream
|
||||
`main` and adds fixes aimed at one goal: getting the game's world to render
|
||||
correctly and playably on one particular PC.
|
||||
|
||||
**This repository contains no game files, code or assets.** You need your own
|
||||
copy of the game. It is not affiliated with or endorsed by the game's
|
||||
developer or publisher.
|
||||
|
||||
## Credits
|
||||
|
||||
- **[VIctory](https://github.com/Marvisak/VIctory)** by Marvisak and its
|
||||
contributors is the base of everything here: the loader, the runtime
|
||||
services, the Direct3D 12 back end and the shader recompiler. Licensed
|
||||
GPL-3.0-or-later; so is this fork. Upstream's history is kept intact below
|
||||
the single commit that carries this fork's changes.
|
||||
- **[XCL](https://github.com/ivall/xcl)** by ivall and its contributors
|
||||
(GPL-2.0-only) was used as a reference for how the same title behaves under
|
||||
another layer. Fixes inspired by it were written anew in VIctory's code.
|
||||
- The guard over every view of a memory page is code by **myokex**
|
||||
([victory-amd](https://github.com/myokex/victory-amd), commit `c6dc4d8`), which
|
||||
adapts pull request #115 here by Spexivus, its correction by joroyt and a part of
|
||||
VIctory #1122 by tightfall. The read-beside fix for kernel reads into title
|
||||
memory is by **Joshua Odom** (commit `10ea38e` of the same fork family). Both
|
||||
are carried here unchanged apart from one merge conflict.
|
||||
- This fork's changes were developed with [Claude Code](https://claude.com/claude-code).
|
||||
|
||||
## Status of this fork (2026-11-25)
|
||||
|
||||
**Not playable yet: 2.5 to 4 frames per second, and shadowed areas are black.**
|
||||
Tested on one machine: Windows 11, Intel i7-14700KF, NVIDIA RTX 4070 12 GB,
|
||||
32 GB RAM. The Series X profile is used throughout.
|
||||
|
||||
| Stage | State in this fork |
|
||||
|-------|--------------------|
|
||||
| Boot, menus, start screen | works, 30 fps (as upstream) |
|
||||
| Opening cutscene | plays from start to finish, in order, lit: title cards, credits cards, night and dusk shots |
|
||||
| Saves | the game autosaves a checkpoint and loads it again |
|
||||
| First gameplay scene (the prologue) | renders: characters, textures, sky, sunlit exterior; HUD, pause menu and pad input work |
|
||||
| Light in shadow | missing: the game's ray-traced bounce light and ray-traced lamp and sun shadows do not run yet, so anything the sun does not hit directly is black |
|
||||
| Frame rate in the world | 2-4 fps: 420-450 ms per frame by default, 240-350 ms with the newer switches (`VICTORY_RELAY=2`, or `VICTORY_LATE_WAIT=3 VICTORY_WIDE_BACK=1 VICTORY_CARD_BUFFERS_MIN_MB=1 VICTORY_CARD_BUFFERS_MB=1024`); it started at 3-6 seconds per frame |
|
||||
| Stability | no driver hang or device loss in normal runs (a hang introduced by the wave64 update was found and fixed: its barrier form for 64-lane programs is now off unless `VICTORY_WAVE_WIDE=1`) |
|
||||
|
||||
### Newest (2026-11-25, later the same day)
|
||||
|
||||
**Update, the same night: the first room now renders right on the test
|
||||
machine** (walls, textures, people, lamps), at 190 to 450 ms a frame (2 to 5
|
||||
frames a second): the picture work has caught up, the frame rate has not.
|
||||
What did it, on top of the list below:
|
||||
- Descriptor records the title copies into its heap as plain bytes are
|
||||
mirrored before every submission (pull request #305 by Flyander, after
|
||||
upstream VIctory 86a5ed6). Measured here: about 40,000 records a frame
|
||||
that no call had announced; their host slots were empty or stale.
|
||||
- A buffer view that does not start on an element of its buffer's host
|
||||
copy gets a copy of its own bytes instead of being refused (after
|
||||
upstream 86a5ed6): 3 to 6 such views a frame.
|
||||
- Room on the card is kept for the render targets and buffer copies a
|
||||
world makes in its first frame: 98 buffer copies are made (945 MB) where
|
||||
the runs before made 1, and the processor no longer compares 550 to
|
||||
710 MB a frame looking for shader writes (25 MB now).
|
||||
- Levels on demand ran on the card for the first time
|
||||
(`VICTORY_LEVELS_ON_DEMAND=1`, still off by default; with the fixes of
|
||||
pull request #747 by AscilCH): 3.1 GB of the card not allocated for
|
||||
texture levels the title does not hold, no device loss.
|
||||
- Guarded blocks under storage writes are opened by default; 14 more
|
||||
shader programs translate; a program is translated with first-half
|
||||
interpolation pairs only if it was refused for one (with that on for
|
||||
every program, 8,551 working pixel programs came out changed).
|
||||
- Known and counted, not fixed yet: an indirect compute pass asks for
|
||||
about 77,500 thread groups in x where one dispatch runs 65,535 (the
|
||||
rest is cut off).
|
||||
|
||||
Memory sync between the title's memory and the copies on the card:
|
||||
- **A write through one view of a physical page is seen by the copies taken
|
||||
through its other views** (`VICTORY_VIEW_GUARD=0` turns it off). The title
|
||||
shows one page at several addresses and a copy was guarded at one of them
|
||||
only. Measured on the test machine: 0.8 to 1.0 million such writes in a
|
||||
five-minute run, every one of which used to leave a copy stale. Since it
|
||||
went in, the first room had its walls in the later frames of 4 runs out of
|
||||
4 (2 of 5 before); the room's very first shot still comes up without walls
|
||||
in some runs.
|
||||
- Kernel reads into title memory are read beside and copied in, so a block
|
||||
guarded again in between no longer fails the read.
|
||||
- Writes of the storage layer into physical pages are counted where the title
|
||||
has those pages mapped (10,000 to 50,000 guarded blocks of copies lay under
|
||||
them in every run) and can open the guards there:
|
||||
`VICTORY_PAGE_WRITES=guards` (off by default; `1`, `slots`, `all` do more).
|
||||
- Failed page-destination reads are retried (`VICTORY_DSTORAGE_RETRIES=0` = as before).
|
||||
|
||||
Card memory (the test card is full from the first frame of the world: 85 to
|
||||
99 % of its budget for a whole run, about 26,000 texture copies let go and
|
||||
3,400 made again in five minutes, 2.8 GB of render targets that are all in
|
||||
use):
|
||||
- Levels on demand, **off by default** (`VICTORY_LEVELS_ON_DEMAND=1`): a
|
||||
texture the title fills takes card memory only for the levels the title
|
||||
holds (2.2 to 3.0 GB of the copies were levels it does not hold). Its test
|
||||
runs on the software adapter; it has not run on a card yet.
|
||||
- Refused texture slots are held back for a few seconds so that a pass
|
||||
reaches the slots behind them (`VICTORY_FULL_CARD_PASS=0` = as before);
|
||||
room can be kept for the card copies of title buffers
|
||||
(`VICTORY_CARD_ROOM_FOR_BUFFERS=1`, off).
|
||||
|
||||
Tools and diagnostics:
|
||||
- `victory translate <shader file> --warm all --jobs N` translates every
|
||||
shader ahead of a run, on the processor only (about 4.5 to 6.5 minutes
|
||||
here); the shader cache is keyed on the translator's source, so a new
|
||||
build that does not touch the translator starts warm.
|
||||
- Counters, all off or diagnostics-only: `VICTORY_MERGE_RACE=1` (title bytes
|
||||
a copy-back is about to put back to older values: none found in 138,000
|
||||
copy-backs), `VICTORY_WALLS_TRACE`, `VICTORY_CARD_ACCOUNTING`, and a census
|
||||
of the copies the texture sweep never lets go.
|
||||
|
||||
### What this fork changed (summary)
|
||||
|
||||
Rendering:
|
||||
- Meshlet culling read its scene buffers as the wrong kind of view, so the world drew almost nothing; fixed.
|
||||
- Per-draw descriptor tables could run out, after which draws used slots never made for them and the card hung; fixed.
|
||||
- Light packed by the game's compute shaders was read back through empty copies (sky, probes, fog); fixed for every mip level and layer.
|
||||
- The fog reconstruction, shadow-mask, hair, blend-shape skinning, fire and several material programs did not translate; fixed.
|
||||
- Gathers at a named mip level (with and without an offset) read level 0; fixed.
|
||||
- Implicit-level samples outside pixel shaders produced invalid DXIL in 730 compute programs; fixed.
|
||||
- Rectangle lists, depth and stencil twins for depth textures written by compute, texture read-backs.
|
||||
- Ray tracing, in progress and off by default: the game's own structure-builder programs translate, title memory can be read by raw address from shaders, the hardware ray/box and ray/triangle test is emulated in DXIL (checked against a reference on the GPU), and 59 of the 64 trace programs translate. Nothing is lit by it yet. See [docs/fork-ray-tracing.md](fork-ray-tracing.md).
|
||||
|
||||
Speed and memory:
|
||||
- Waits for memory values, write-watch queries and page queries no longer walk page tables per call.
|
||||
- Large title buffers get a copy in card memory, with shader writes found by hashing on the card.
|
||||
- Submissions can be sent ahead of the wait for the card (`VICTORY_LATE_WAIT`), with a relay thread that lands results as the card finishes (`VICTORY_RELAY`): in a first five-minute run the card's idle time behind the submitting thread fell from about 136 to 30 ms per frame.
|
||||
- Independent host-copy refreshes run in parallel by default on systems with at least four logical CPUs (`VICTORY_WIDE_REFRESH=0` disables this; `=1` forces it). This targets the serial memory reads that previously cost about 45–50 ms per frame on the test run.
|
||||
- Title memory can be opened as a graphics heap so that buffers are used in place instead of copied (`VICTORY_INPLACE`, first stage only; a probe confirmed the approach on the test GPU).
|
||||
- The bindless texture queue no longer uploads stale views; the view table no longer grows without bound; the pipeline library is mapped instead of read into memory.
|
||||
- An intermittent device loss was traced to the pipeline library file being replaced while mapped; fixed.
|
||||
|
||||
- Translated shaders get clean-up passes over the finished module (dead code, constant folding, reuse of values, branch facts); the pack's host instruction count falls by about 43 %, worth about 20 ms of GPU time per frame on the test machine (`VICTORY_SHADER_OPT=0` turns them off).
|
||||
|
||||
Most of the newer speed changes sit behind environment switches that are off
|
||||
by default (`VICTORY_LATE_WAIT`, `VICTORY_RELAY`, `VICTORY_WIDE_BACK`,
|
||||
`VICTORY_CARD_BUFFERS_MIN_MB`, `VICTORY_INPLACE`, `VICTORY_BVH_BUILDER`, ...).
|
||||
Independent host-copy refreshes are the exception: they use parallel workers
|
||||
automatically on systems with at least four logical CPUs. Each switch is
|
||||
described in a comment where it is read.
|
||||
|
||||
### Known problems
|
||||
|
||||
- Everything in shadow is black (see above).
|
||||
- The interior of the first gameplay room is sometimes not drawn after the cutscene hands over to gameplay.
|
||||
- Around 24 GB of memory is in use during play.
|
||||
- A few style lints are switched off for this fork in the workspace `Cargo.toml` until the newer code is tidied.
|
||||
- Many changes here are specific to this title and this GPU, and some are marked `shortcut:` in the code where they approximate what the console does.
|
||||
|
||||
Everything below this line is upstream VIctory's own README, unchanged; its
|
||||
status section describes upstream, not this fork.
|
||||
|
||||
---
|
||||
|
||||
# VIctory
|
||||
|
||||
Runs the title (Xbox Series X|S) natively on Windows, from files
|
||||
the user supplies.
|
||||
|
||||
The title's x86-64 code runs unchanged inside our process; VIctory supplies
|
||||
the platform underneath it and converts the title's data, ahead of time where
|
||||
it can (shaders and pipelines too, see Getting started) and on first use
|
||||
otherwise. See [docs/architecture.md](architecture.md).
|
||||
|
||||
## Status (2026-11-24)
|
||||
|
||||
**Not playable yet.** The title boots, runs its menus at its own 30 fps,
|
||||
loads the world and shows it: slowly, and with rendering defects.
|
||||
|
||||
| Stage | State |
|
||||
|-------|-------|
|
||||
| Boot, first-boot screens (accessibility, language, settings, legal) | works, 30 fps |
|
||||
| Intro video with sound | works |
|
||||
| Start screen, profile and saves | works |
|
||||
| Loading into the world (about 50 s) | works |
|
||||
| The world (first mission's intro) | drawn and shown: streets, buildings, vehicles, characters, the title card and credits; 1-2 s per frame. Surfaces are unlit, a band of distant geometry is missing, characters come out broken in some shots |
|
||||
|
||||
Tested on one machine: Windows 11, AMD RX 6700 XT.
|
||||
|
||||
> **Warning.** Entering the world on a real GPU has hung it in earlier
|
||||
> builds, and Windows then resets the display driver (every monitor goes
|
||||
> black for a moment). The latest runs did not, but it is not ruled out; a
|
||||
> run can also end on a GPU fault (`crashes.log`). A diagnostics build with
|
||||
> `VICTORY_D3D12_WARP=1` renders on the software adapter instead (too slow
|
||||
> to reach the world in minutes).
|
||||
|
||||
What each part does today and what it still needs:
|
||||
|
||||
| Subsystem | Today | Needs |
|
||||
|-----------|-------|-------|
|
||||
| Loader | Runs the title's executable and its DLLs in our process; crash reports name the faulting code and are kept in `crashes.log` | – |
|
||||
| Runtime services | One signed-in offline user, licences, packages, saves that survive a kill at any step, text entry dialog | Speech is silent; the dialog and relaunch are untested live |
|
||||
| Network | Offline by design: the title cannot reach the network | – |
|
||||
| Files and streaming | Archives and streamed data read, zlib and BCPack decoded in parallel | Loading is limited by writes into title memory |
|
||||
| Input | XInput pads, keyboard, keyboard stand-in pad | Trigger rumble |
|
||||
| Audio | Menu, video and loading sound; XMA voices and Opus streams decode | Reverb is silent; Opus results unverified against the title |
|
||||
| GPU: menus | Draws, compute and presentation on host D3D12; only changed title memory is copied | Frame pacing drifts on one screen in release builds |
|
||||
| GPU: world | The scene is drawn and presented: mesh pipelines, indirect execution, views the shaders pick from the heap themselves, title memory read by address (ray-tracing structures), depth written from compute, pipelines pre-built or made by worker threads and kept on disk | Lighting (surfaces are unlit) and some missing geometry; frames take 1-2 s; draws of untranslated shaders are dropped; real queries, depth bounds, HDR and scaling are missing |
|
||||
| Shaders | Console GPU code recompiled to DXIL, ahead of time (`translate --cache`) or at first use, cached on disk. Menus: all. World: mesh 8,765 of 8,765, vertex/pixel 12,550 of 12,592, compute 2,579 of 2,637 | Merged geometry stages (195 programs) and about 100 others; fused multiply-adds follow the host GPU; some compute programs need a GPU with 64-lane waves |
|
||||
| Textures | Console tiled layouts and detiling for the modes the title uses | Render-target metadata planes |
|
||||
| Series S mode | Runs through the menus to the loading screen | The world, as above |
|
||||
|
||||
## Getting started
|
||||
|
||||
Requirements: Windows 10/11 x64, a CPU with AVX2, a Direct3D 12 GPU with
|
||||
shader model 6.6 (and mesh shaders for the world), Rust (pinned in
|
||||
`rust-toolchain.toml`).
|
||||
|
||||
To install Rust, use rustup (`winget install --id Rustlang.Rustup -e`, or
|
||||
the installer from https://rustup.rs). The first `cargo` command in this
|
||||
repository then fetches the pinned toolchain. Building needs the MSVC C++
|
||||
build tools: Visual Studio or its Build Tools with the "Desktop development
|
||||
with C++" workload.
|
||||
|
||||
The title also needs several GiB of available Windows commit at startup.
|
||||
Check **Committed** under **Task Manager → Performance → Memory**. If
|
||||
`crashes.log` reports Windows error 1455, close other applications or increase
|
||||
the Windows paging file size, then retry.
|
||||
|
||||
```powershell
|
||||
cargo xtask install-hooks # asset-policy check on every commit
|
||||
copy victory.example.toml victory.toml # then set your paths (outside the repo)
|
||||
cargo test --workspace # needs no game data
|
||||
cargo run -p victory -- config # check your paths
|
||||
```
|
||||
|
||||
Run the title:
|
||||
|
||||
```powershell
|
||||
cargo build --release -p victory
|
||||
target\release\victory.exe run <game dir>\<the title's exe> --execute
|
||||
```
|
||||
|
||||
The window caption shows the framerate. Saves, settings and `crashes.log`
|
||||
are kept under the data folder (default `%LOCALAPPDATA%\victory\data`), derived
|
||||
data under the cache folder.
|
||||
|
||||
Set `VICTORY_WINDOW_MAX=1920x1080` before launching to limit the title's
|
||||
top-level window to that bounding box. Smaller windows keep their size,
|
||||
larger windows keep their proportions, and the monitor's work area still
|
||||
limits them. This scales the displayed image; it does not change the
|
||||
console render resolution or the swap-chain buffers. With the variable
|
||||
unset, window sizing is unchanged.
|
||||
|
||||
Input: XInput pads. With none connected the keyboard is a pad while the
|
||||
title's window has focus:
|
||||
|
||||
| Keys | Pad |
|
||||
|------|-----|
|
||||
| W A S D / I J K L | left / right stick |
|
||||
| arrows | D-pad |
|
||||
| Enter, Backspace, X, Y | A, B, X, Y |
|
||||
| Q / E, Z / C | shoulders, triggers |
|
||||
| F / H | stick clicks |
|
||||
| Esc, Tab | Menu, View |
|
||||
|
||||
## Commands
|
||||
|
||||
```
|
||||
victory inspect <exe|dll> [--imports] [--exports]
|
||||
victory census [paths...] [--missing] [--strict]
|
||||
victory lib-exports <import.lib> [--list]
|
||||
victory shader-info [paths...] [--verbose] [--disasm]
|
||||
victory translate [paths...] [--validate] [--pipelines] [--list] [--jobs N]
|
||||
victory run <exe> [--execute] [--unimplemented trap|zero] [--strict]
|
||||
[--console series-x|series-s] [-- <title arguments>]
|
||||
victory config
|
||||
```
|
||||
|
||||
Logging: `VICTORY_LOG=victory_loader=trace,info` (a release build logs
|
||||
info and above).
|
||||
|
||||
### Windows shader-test validator
|
||||
|
||||
The shader tests use `dxil.dll` to validate Shader Model 6.6 containers.
|
||||
An older Windows SDK validator can load successfully but reject them with
|
||||
`Unknown shader model 'ps_6_6'`. If this happens, use a current x64 validator
|
||||
from [Microsoft's DirectX Shader Compiler releases](https://github.com/microsoft/DirectXShaderCompiler/releases)
|
||||
or a current Windows SDK. Set its path for the test session:
|
||||
|
||||
```powershell
|
||||
$env:VICTORY_DXIL = 'C:\tools\dxc\bin\x64\dxil.dll'
|
||||
cargo test -p victory-shader --lib --locked -- --test-threads=1
|
||||
```
|
||||
|
||||
Without this override, the validator loader selects the newest installed
|
||||
Windows SDK's `bin/<version>/x64/dxil.dll`, then falls back to the DLL search
|
||||
path when no SDK copy is found. This is a test/offline-validation dependency;
|
||||
the translated shaders do not require it at runtime.
|
||||
|
||||
## Debugging
|
||||
|
||||
A release build has no debugging aids. Build them in with
|
||||
|
||||
```powershell
|
||||
cargo build --profile diag -p victory --features diagnostics # target\diag\victory.exe
|
||||
```
|
||||
|
||||
The on/off switches below (`...=1`) are off when unset or set to `0`.
|
||||
|
||||
| Variable | Effect |
|
||||
|----------|--------|
|
||||
| `VICTORY_LOG=<target>=debug,...` | debug and trace output |
|
||||
| `VICTORY_STACKS=20,60` | every thread's stack at those seconds |
|
||||
| `VICTORY_WATCH=<rva>,...` | logs a title u32 when it changes |
|
||||
| `VICTORY_POKE=<rva>:<byte>,...` | writes a title byte twice a second (a hang watchdog's tick, say) |
|
||||
| `VICTORY_KEYS=30:Enter,35:X` | presses keys at those seconds, focus or not |
|
||||
| `VICTORY_CRASH_SAVE=<rva>:<len>,...` | saves title memory to the cache folder on a crash |
|
||||
| `VICTORY_CAPTURE=<dir>` | saves presented frames (powers of two, or `VICTORY_CAPTURE_FRAMES=<list>`) |
|
||||
| `VICTORY_DUMP_TARGETS=1` | with the two above, saves every render target of those frames |
|
||||
| `VICTORY_D3D12_DEBUG=1` | host debug layer |
|
||||
| `VICTORY_D3D12_GBV=1` | with the above, GPU-based validation (bad descriptor use reported, not faulted; slow) |
|
||||
| `VICTORY_D3D12_DRED=1` | on a GPU failure, the allocation hit and the commands in flight |
|
||||
| `VICTORY_PIPELINE_WAIT_MS=24` | reduce the per-frame wait for background pipeline creation from the default of 500 ms. A draw can be omitted until its pipeline is ready |
|
||||
| `VICTORY_SKIP_PIPELINES=<hash>,...` | omit draws and dispatches, including indirect ones, whose pipeline contains a listed 16-digit shader hash |
|
||||
| `VICTORY_GPU_TIMING=1` | with the above, each list of a submission run and timed on its own; slow lists logged with their slowest commands |
|
||||
| `VICTORY_D3D12_WARP=1` | host device on the software adapter (slow; cannot reset the driver) |
|
||||
| `VICTORY_SHADER_LOOP_LIMIT=<n>` | translated shader loops stop after `n` iterations per lane instead of 2^20 (own shader cache entries); if a lower `n` makes world frames much faster, loops hitting the limit are what makes them slow |
|
||||
| `VICTORY_AUDIO_CAPTURE=<file.wav>` | records what the title plays (our process only) |
|
||||
| `VICTORY_XMA_DUMP=<dir>` | saves the first 32 XMA voices' context and input |
|
||||
|
||||
Every build appends crashes and host GPU failures to `crashes.log` in the
|
||||
title's data folder.
|
||||
|
||||
## License
|
||||
|
||||
GPL-3.0-or-later. See [LICENSE](../LICENSE).
|
||||
|
||||
@@ -45,7 +45,7 @@ user's dump), `test_titles`, and `cache_dir` for everything derived
|
||||
1. `.gitignore` keeps common data types out of `git status`.
|
||||
2. `cargo xtask policy` (run by the pre-commit hook; install with
|
||||
`cargo xtask install-hooks`) is an allowlist: files must have an allowed
|
||||
type, be under 512 KiB, contain no binary data or known binary
|
||||
type, be under 640 KiB, contain no binary data or known binary
|
||||
signatures, and hold no long hex/base64 runs. Exceptions need an entry
|
||||
with a reason in `xtask/src/policy.rs`.
|
||||
3. At runtime, everything that writes derived data calls
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
# What was learned on the RX 7900 XTX (2026-11-23 to 2026-11-25)
|
||||
|
||||
One PC: i9-12900K (8 fast cores, 8 slow ones, 24 threads), 64 GB, Radeon RX 7900 XTX
|
||||
24 GB, Windows 11, 1440p, Series X profile. Figures are of diagnostics builds with a
|
||||
screenshot a second. Scenes are not the same from run to run, so read differences
|
||||
under about 5 % as nothing. What a switch does is in the comment where it is read.
|
||||
|
||||
## Where a frame goes
|
||||
|
||||
Median of whole runs, same part of the prologue: 280 ms, then 124, 103, 75, now 46-65.
|
||||
On the water (first boat mission) 46-53 ms.
|
||||
|
||||
The title needs 33 ms. Of a 55 ms frame on the water:
|
||||
|
||||
- **The thread that prepares submissions: 48 ms.** It is the wall. Steps of the lists
|
||||
18 (refreshes of host copies 10), steps done on the card 7, waiting for descriptor
|
||||
records 6, asking the write watch 5, copies in the card's memory 4, the title's bytes
|
||||
under shader writes 4.
|
||||
- **The card: about 41 ms busy**, the next wall.
|
||||
- **List calls: 36,000 a frame, 230 ms of work** spread over eight threads. In a street
|
||||
chase 67,000 calls and 430 ms.
|
||||
- Descriptor records copied as plain bytes: 400,000 slots looked at, 40,000 mirrored a
|
||||
frame, most of them empty.
|
||||
- Landing what shaders wrote: 16 MB a frame put as dwords, on a thread of its own.
|
||||
|
||||
## The one idea behind most of it
|
||||
|
||||
On the console the CPU and the graphics processor share memory. Here they do not, so
|
||||
everything one writes and the other reads must be noticed and moved. Every large cost
|
||||
is one of four: **noticing** writes of the title (write watch, guards), **noticing**
|
||||
writes of shaders (hashes on the card, compares on the CPU), **moving** them, and
|
||||
**waiting** until an order is safe. Gains came from making each of them narrower
|
||||
(dwords, not pages), wider (threads, AVX2) or later (on the card, behind the frame),
|
||||
in that order of size:
|
||||
|
||||
| What | Frame before | after |
|
||||
|---|---|---|
|
||||
| Descriptor records of draws' tables left to the draws | 280 ms | about 124 |
|
||||
| Our hash passes over card copies, 64 threads a piece | card 79 ms | 66 |
|
||||
| Preparing on a thread of its own, refreshes and records spread | 103 | 75 |
|
||||
| List calls written down and translated by eight threads (`VICTORY_THIN`) | 75 | 68 |
|
||||
| Submissions joined, card steps, textures sent ahead | 68 | about 63 |
|
||||
| Title bytes under shader writes compared with AVX2 on six threads | 14 ms of it | 4-7 |
|
||||
| Stores into guarded memory looked at first, fewer guards reset | 69 ms of threads' time | about 6 |
|
||||
|
||||
(Each figure is from the run in which it was measured; they overlap and do not add up.)
|
||||
|
||||
## Faults found, and what they were
|
||||
|
||||
- **Boats sank, the sea plane went under.** The ocean's height and displacement maps are
|
||||
textures that compute passes write and the title's physics sample on the CPU. They were
|
||||
never brought back to title memory. Fixed by Geckomacabre's read-back as merged in
|
||||
fxceless/victory-fork f5c03f3b; on by default here (`VICTORY_TEXTURE_BACK=0`: off).
|
||||
With it the boat stays up through a whole run; without it sank in every one.
|
||||
- **A device loss about every 16 minutes**: a page fault inside a texture made in the same
|
||||
tenth of a second. A slot showed it before its upload had run.
|
||||
`VICTORY_SHOW_AFTER=1`; none in the sessions since (likely fixed, not proven).
|
||||
- **A rare lost write** (6 of 200 runs of a stress test): a view was mapped between our
|
||||
look at its guards and our lock, and views were opened one after another. None in 603
|
||||
runs after.
|
||||
- **Blocky patches**: indirect dispatches cut at 65,535 groups.
|
||||
- **Square holes and dashed edges in shadows**: pixel shaders that read their quad's
|
||||
neighbours with wave reads; on AMD helper lanes take no part in them.
|
||||
- **Cube reflections too blurred, wrong materials**: DXIL's `Log` is base 2, and
|
||||
normalized buffer codes were one step off.
|
||||
- **Every ray missed**: the dispatch flag that says counts are threads, not groups.
|
||||
|
||||
## Measured and not worth it
|
||||
|
||||
- Unordered early pipelines for everything (AMD's compiler crashed).
|
||||
- Series S profile, smaller textures, a second drawing queue, `ASYNC_SUBMIT` off.
|
||||
- Mapping pages on sixteen threads: no more pages mapped, frames longer.
|
||||
- Scalar buffer loads four dwords a call (`VICTORY_SHADER_OPT=127`): no gain on this card.
|
||||
- Wave sizes, fused multiply-adds, fast reciprocals, raw picked buffers, leaving out
|
||||
barriers: nothing to 0.1 ms each. Exact RDNA float rules (`VICTORY_RDNA_FLOAT`): 0.8 ms.
|
||||
- Running the console's shader code natively on the card: the Windows driver takes no raw
|
||||
code, the two generations differ, and a Vulkan host layer ends at the same compiler. What
|
||||
is left to gain from shader code was guessed at under 1 ms.
|
||||
- An on-screen panel of numbers (`VICTORY_PANEL`): it helps finding where a frame goes but
|
||||
costs some, so it is off and F3 shows it.
|
||||
|
||||
## What is next
|
||||
|
||||
1. The preparing thread: split what one submission does over two threads in a row; ask
|
||||
for the next submission while this one is sent; view the card's own buffers where fills
|
||||
copy them now.
|
||||
2. The card: small buffers' copies in its own memory (`VICTORY_CARD_BUFFERS_MIN_KB=64`,
|
||||
after fxceless c36971b2; not measured here yet), and the passes that run for nothing
|
||||
without rays.
|
||||
3. Stalls: 270-660 s of a session were full of frames over 200 ms, almost all while new
|
||||
pipelines were made. `victory warm`, and a quarter of the workers for the slow ones.
|
||||
4. Outdoor flicker: suspected to be one bad indirect record that uses up its list's
|
||||
budget, so that every later draw of it is empty. The log's frame line counts them;
|
||||
`VICTORY_INDIRECT_REST=0` is the experiment.
|
||||
5. Memory, 40-46 GB private: lists' allocators 9 GB, windows 7, uploads 4
|
||||
(`VICTORY_MEMORY_MAP=1` lists it).
|
||||
|
||||
## The other repositories, compared
|
||||
|
||||
Read up to 2026-11-25: Marvisak/VIctory, fxceless/victory-fork, DexNom/VIctory,
|
||||
Belobug/VIctory-Belobug-AMD, FQY55kai/ZJOU-VICTORY. What was taken is in the history,
|
||||
each commit naming its source. In short:
|
||||
|
||||
- Marvisak's commits hardly apply any more; nearly all of what they fix is here, often
|
||||
another way. Taken: nearest normalized codes, d16 views, shader model flags.
|
||||
- fxceless: the base. Newest taken: texture read-back, small buffers on the card, hashes
|
||||
over a buffer's own bytes.
|
||||
- DexNom: thread counts of ray dispatches, cube gradients, joined sparse ranges.
|
||||
- Belobug: pipeline workers for screen passes, the ambient stand-in's idea, pipeline and
|
||||
constant buffer bookkeeping (romainhedouin).
|
||||
- ZJOU: render targets not set again; some shader corrections are being looked at.
|
||||
@@ -0,0 +1,38 @@
|
||||
# Starts the title with the settings this fork is played with (README.md, "How to run it").
|
||||
# scripts\play.ps1 -Exe <path of your own copy's executable>
|
||||
# -Safe without the newer, faster ways (the first thing to try when something is wrong)
|
||||
# -RayTracing the title's own ray-traced indirect light: lit interiors, about a third slower
|
||||
# -Build target\diag (the default, the build all measurements are of) or target\release
|
||||
# -More other settings: -More @{VICTORY_PANEL='1'}
|
||||
# Run it from a normal window, not as administrator: the driver then keeps its shader cache elsewhere.
|
||||
param(
|
||||
[Parameter(Mandatory)][string]$Exe,
|
||||
[switch]$Safe,
|
||||
[switch]$RayTracing,
|
||||
[ValidateSet('diag', 'release')][string]$Build = 'diag',
|
||||
[hashtable]$More = @{}
|
||||
)
|
||||
$settings = @{
|
||||
VICTORY_TEXTURE_NO_WAIT = '1'; VICTORY_RELAY = '2'; VICTORY_WIDE_BACK = '1'; VICTORY_CARD_REHASH_RUNS = '1'
|
||||
VICTORY_JOIN_COPIES = '1'; VICTORY_INDIRECT_WINDOW = '1'; VICTORY_RELAY_COPY = '1'; VICTORY_CARD_STEPS = '2'
|
||||
VICTORY_INDIRECT_BATCH = '2'; VICTORY_MAP_THREADS = '1'; VICTORY_TITLE_PRIORITIES = '0'; VICTORY_CARD_AWAKE = '1'
|
||||
VICTORY_SHOW_AFTER = '1'; VICTORY_AMBIENT = '0.8'; VICTORY_D3D12_DRED = 'light'; VICTORY_SKIP_PIPELINES = 'none'
|
||||
}
|
||||
if ($Safe) {
|
||||
$settings.VICTORY_UNDER_WIDE = '0'; $settings.VICTORY_LAND_ECHO = '0'
|
||||
} else {
|
||||
$settings.VICTORY_THIN = '1'; $settings.VICTORY_JOIN_PARTS = '8'; $settings.VICTORY_UPLOAD_AHEAD = '1'
|
||||
}
|
||||
if ($RayTracing) { $settings.VICTORY_BVH_BUILDER = '1' }
|
||||
foreach ($k in $More.Keys) { $settings[$k] = $More[$k] }
|
||||
|
||||
$victory = Join-Path $PSScriptRoot "..\target\$Build\victory.exe"
|
||||
if (-not (Test-Path $victory)) { Write-Host "No $victory. Build it first (README.md)."; return }
|
||||
if (-not (Test-Path $Exe)) { Write-Host "No $Exe."; return }
|
||||
# (Other settings left over in this window go; where your files are stays.)
|
||||
$paths = 'VICTORY_CONFIG', 'VICTORY_GAME_DIR', 'VICTORY_CACHE_DIR', 'VICTORY_DATA_DIR'
|
||||
Get-ChildItem Env:VICTORY_* | Where-Object { $_.Name -notin $paths } | ForEach-Object { Remove-Item "Env:$($_.Name)" }
|
||||
foreach ($k in $settings.Keys) { Set-Item "Env:$k" $settings[$k] }
|
||||
$Exe = (Resolve-Path $Exe).Path
|
||||
Push-Location (Join-Path $PSScriptRoot '..') # victory.toml is looked for here
|
||||
try { & $victory run $Exe --execute } finally { Pop-Location }
|
||||
+2
-1
@@ -10,7 +10,8 @@ use std::process::Command;
|
||||
|
||||
use anyhow::{Context, Result, bail};
|
||||
|
||||
const MAX_FILE_SIZE: usize = 512 * 1024;
|
||||
// (The translator's one file is 570 KiB of source.)
|
||||
const MAX_FILE_SIZE: usize = 640 * 1024;
|
||||
const MAX_ENCODED_RUN: usize = 512;
|
||||
|
||||
const ALLOWED_EXTENSIONS: &[&str] = &[
|
||||
|
||||
Reference in new issue
Block a user