GPU: texture refreshes do not wait for the title-memory lock by default (mitigates the title's stop at world entry: 9 of 25 entries before, 0 of 15 with it) #137
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/137"
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?
Imported from Zettrox/ztrx. Originally posted by Impre-visible on 2026-11-25T13:45:31Z.
What
Makes
VICTORY_TEXTURE_NO_WAITthe default (texture refreshes read through the kernel or retry at the next refresh instead of waiting for the title-memory lock);VICTORY_TEXTURE_NO_WAIT=0restores the old waiting. One small test for the switch's parsing.It is a mitigation, not a fix, for a stop at world entry that hit about one run in three on my machine (GTX 1660, Linux, Wine + vkd3d-proton
2576c0b).The stop it mitigates
Symptom: a few frames into the world the title ends itself with its own unhandled access violation writing address 0, from a thread started directly by
kernel32(its watchdog). NoXid, no device removal. Possibly what #28 and #39 describe, but I cannot tell from here.What I measured with stall dumps (state of our queues and locks plus every thread's stack at 12 s and 24 s without a present, and at the exception) in three such runs:
WaitForSingleObject/Sleep; no VIctory frame between title code and the wait.So it is a race inside the title (a slot freed and reused within one frame), with a window of one frame of wall-clock time: 33 ms on the console, 6 to 8 s at world entry here. Nothing of ours writes that table. Disabling the title's watchdog cannot help: the lookup never ends, the title would hang instead.
Why this change
Of those 6.5 s entry frames, 1.0 to 1.9 s per frame were texture refreshes waiting for the title-memory lock (the
waiting for title memoryfigure in the frame statistics). With this change that figure is 0.0 ms in the runs below. No work is skipped; a texture can show one frame late.Measured
World entries on the same machine and tree, counted one run at a time:
Fifteen entries in a row without that stop would happen by chance about once in 800 at the old rate (16 of 25 entries survived).
To be complete about those 15 runs: 13 were clean; one had a single 16 s frame in the steady scene (CPU side: 5.4 s preparing, 6.9 s copying back, 0.8 s on the card) and then went on; one ended with
Xid 10913 s after world entry. Neither is the stop described above (no spinning title job). Both happened on a tree that also carries #119; see the caveat I posted there for theXid. I have no evidence that this change causes or prevents either.Checks on this branch alone: Windows
cargo check -p victory --features diagnosticsclean;cargo test -p victory-shader --lib170 passed, 2 ignored. The new test invictory-gpucompiles but I did not run it (that crate's tests need a Windows device).Not tested / limits
No game files, addresses, strings or hashes in this PR.
🤖 Generated with Claude Code
Imported from Zettrox/ztrx. Originally posted by Ege-Mert on 2026-11-25T14:41:03Z.
Windows 11, NVIDIA RTX 3060 Laptop 6 GB, Series S profile. The PR body lists Windows and NVIDIA as untested, so here is what running that way looks like on a small card — we have had the equivalent wait skipped for several days, which is the configuration this change makes the default.
With the card at its memory line, texture refreshes waited 4–12 s per world frame for title memory to hold still. With the wait skipped the texture pass fell to 25–170 ms per frame. That is a much longer wait than the 1.0–1.9 s reported in the PR body; I would put that down to a 6 GB card sitting at its line with textures churning, not to a difference in behaviour of the change itself.
On a later tree that also carries parallel texture checks and coalesced refreshes, the texture pass costs 24 ms a frame at full read rate, with a median frame of 876 ms against 1,263 ms when the wait is skipped on the same shaders. One run each, and the spread between identical runs on this machine is about ±25 %, so I would take the texture-pass time as the reportable part and not the frame times.
We have not counted world-entry stops, so nothing from us on the 9-of-25 to 0-of-15 figure either way.
Written with Claude Code (model claude-opus-5).
Imported from Zettrox/ztrx. Originally posted by carlosmegino on 2026-11-25T15:00:32Z.
Independent Windows validation of exact head
55fb82c90a056aae1767afb795ad010bb3c9af5b, in a clean isolated worktree. Windows 11, i7-8700K, RTX 5070 Ti 16 GB (driver 621.01), 32 GB RAM, pinned Rust 1.98.1.Exact PR branch checks
cargo test -p victory-gpu --locked -- --test-threads=1: 111 passed, 0 failed, 1 ignored, including the new switch-parsing test.-D warnings: pass.cargo fmt --all -- --check: fails with repository-wide formatting differences; it also failed on our original-main reference. No formatting changes were applied.Separate opt-in runtime observation
The runtime trial used our previously preserved combined compatibility binary based on
90b529f(#56, #36, opt-in profiling/input diagnostics and the LDS-mode cache-key fix), withVICTORY_LDS_FLAGS=0andVICTORY_TEXTURE_NO_WAIT=1. It exercises the existing path; it is not a runtime test of the exact PR executable or the changed default.One requested 1,200-second run reached the deadline and was intentionally stopped by the harness (1,205.8 s including shutdown). No unhandled-exception/device-removal/panic message was found. All 717 detailed texture-meter windows reported 0.0 ms waiting for title memory; 494 windows reported kernel reads/deferred refreshes. The preceding waiting-mode control, using the same executable with LDS disabled, had positive waits in 226/234 texture windows and ended spontaneously with a guest breakpoint.
The runs used independent copies of the same frozen data seed, but cache conditioning and startup input timing differed. One deadline-limited survival does not establish a crash-rate reduction or the failure's mechanism. Visual output alternated between nearly blank and partial 3D images; interactive world entry and visual equivalence remain unverified. No FPS improvement is claimed.
The exported prefix contains 3,233 successful Present and 765 meter records; all 3,998 CSV/JSONL pairs match with no reported loss. Raw title logs, reports, captures and resources remain local.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.