Files: read-only opens go through the host file cache, and a failed texture detile is retried #470
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Belobug--VIctory-Belobug-AMD!470
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-470"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@remembering7896 on GitHub · 2026-11-27 04:12 UTC · original
remembering7896:port-filecache-and-detile-retry→a-publier· +422 −145 · 4 files · 2 commits · openTwo fixes ported from the sibling fork avatarmanz/VIctory-7900XTX (base
014d52d), where they were first written and tested. Both are separate commits, so they can be reviewed and taken separately.1. Files: the title's read-only opens go through the host file cache
Port of avatarmanz/VIctory-7900XTX#423 by Jesper-Andersson.
The title opens its packs read-only with
FILE_FLAG_NO_BUFFERING, andfiles::CreateFileWpassed the flag to the host unchanged. On Windows that flag keeps every read of those files out of the system file cache, so every launch reads the same bytes from the drive again.Change (
crates/victory-hle/src/modules/files.rs):files::host_flagsis called byCreateFileWandCreateFileAbefore the host's open. An open whose access is exactlyGENERIC_READand which is not overlapped losesFILE_FLAG_NO_BUFFERING.ReadFileScatterneeds a handle with both.Switch:
VICTORY_FILE_CACHE=0keeps the flag, as before. On by default.Where it does nothing: opens with any write access, overlapped opens and opens without the flag are unchanged;
CreateFile2(used by Bink) keeps its flags; DirectStorage reads open handles of their own.2. Textures: a failed detile conversion is retried
Port of avatarmanz/VIctory-7900XTX#419 by feanorsun.
Staging recorded the source digest before detiling the first mip. If a later mip failed, the next refresh could accept the same input as a cache hit, so a half-converted texture stayed broken. The write-watch path could also advance its watermark, and a caller reading the whole texture could still pass it to the texture store.
Change:
crates/victory-formats/src/texture.rs,crates/victory-gpu/src/texture.rs,crates/victory-gpu/src/texture/ahead.rs: commit the digest after the last subresource succeeds. A failed attempt clears the digest and the write-watch watermark and leaves the upload pending. Every footprint is checked against the same boundsLayout::detileuses before writing or zeroing any mip.Measured (this machine)
RX 7900 XTX 24 GB, Ryzen 7 9800X3D, 32 GB RAM, Windows 11 build 26300,
cargo build --locked --profile diag -p victory --features diagnostics.2) detile retry. Two runs of the same tree, same settings, same place; the comparison window is the first 150 s after the start (the loading phase):
In the world the frame time is unchanged by the patch (median 46.4 ms, p90 51.8 ms, no frame over 120 ms, against a median 44.7 ms / p90 58.0 ms reference run of the same build without the patch), so there is no performance cost. The warning families in the two logs are the same (device, descriptor::host, draw, texback, object) - no new failure mode.
1) file cache. The switch is active on this setup: the log shows
files: read-only opens go through the host file cache on=trueand the title's opens (access=0x80000000,flags=0x20000000) come outcached=true. The launch time to the first rendered frame is unchanged here (6.06-6.14 s with the patch, 6.16-6.32 s without, three launches each): the game sits on an NVMe, where an unbuffered read costs nothing, so the win the original report measured on a SATA SSD (34-37 s -> 21-23 s) does not apply to this box. The change is kept because it is the same behaviour the console has (its reads are buffered) and it removes a needless read path.Validation
cargo build --locked --profile diag -p victory --features diagnostics- ok (41.3 s)cargo test --locked -p victory-gpu --lib detile- 5 passed, 0 failed (the fourtexture::detile_retrytests included)cargo xtask policy- 272 files ok--execute:94 hle / 421 host / 72 title / 0 missing, exit 0Notes
VICTORY_FILE_CACHE=0turns the file-cache change off (unbuffered reads, as before).@gw1337x on GitHub · 2026-11-27 04:59 UTC · original
Ran in the title on RDNA 3: RX 7800 XT 16 GB (driver 32.0.32015.7029), Ryzen 7 9800X3D, 32 GB RAM, Windows 11 26200 (Memory Integrity off). Diagnostics builds of
e77f5ddand its base4eb6cfd, same boot.Settings:
scripts/play.ps1settings plusVICTORY_PORT_CONSTANTS/DESCRIPTORS/CBV/GUARD/JOURNAL=1, Series X profile, ray tracing off,VICTORY_FILE_CACHEunset (on). Method: 270 s hands-off from a Chapter I boat save with the same scripted presses each run; the window title's 1 s fps and draw count sampled every second. "World" is the first second with 1,000+ draws a frame.The switch is active: the log has
files: read-only opens go through the host file cache (VICTORY_FILE_CACHE) on=trueand 8the title opened a file unbuffered ... cached=truelines per run.e77f5dd4eb6cfde77f5dd4eb6cfdFor a wider base: 10 other runs of builds without this PR in the same boot (the base and other PRs, same test) reached the world at 40.7-44.2 s (7 of them at 41.1-41.2 s).
So the world comes up about 5 s sooner with the PR, from the file cache presumably (the runs were back to back, so the packs were in the cache from earlier runs; a first launch after a reboot was not measured). Seconds under 15 fps in the cutscenes vary too much between runs to say anything (4 and 14 against 24 and 14). No device loss, peak commit 33.8-34.3 GB for both. The detile half: no detile failures are logged in the base runs here, so it probably did not come into play.
@MamaLeVrai on GitHub · 2026-11-27 05:38 UTC · original
Tested on an RX 6950 XT (RDNA 2), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release. At
e77f5dd:victory-gpu400 passed, 0 failed, 34 ignored;victory-hle163 passed, 0 failed, 2 ignored;victory-formats42 passed, 0 failed, 5 ignored.AI-assisted (Claude Code); no game data.
@gw1337x on GitHub · 2026-11-27 12:07 UTC · original
#477 and #470 stack, measured together. Memory Integrity was off.
PC: Ryzen 7 9800X3D, RX 7800 XT, 32 GB. Test: 270 s hands-off boat scene, RT off, Belobug launcher settings plus the 5 port switches. I made a local build of #477 (
0834177) with #470's two commits cherry-picked on top (no conflicts) and ran it withVICTORY_WC_NO_BACK=1. Compared against4eb6cfd, 3 runs each, interleaved.4eb6cfdEach PR keeps its own gain when they're combined: #477's steady fps and #470's faster load.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.