GPU: a read slot is resolved once, not twice #3213
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3215"
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 Marvisak/VIctory. Originally posted by borosf on 2026-11-26T13:21:29Z.
Summary
descriptor::make_readresolved every read slot twice: firstHostHeap::mirror— the made-keys lock, the global views lock, a clone of the view, plus the kept lock when a texture view needs remaking — and thenstamp_read, which looked the same slot up again through the same two locks and a second clone, only to stamp theHostTexturethe view holds.mirroralready has the view in hand and returns it, so the stamp now takes the view:stamp_read_view(&view).stamp_readhad no other caller, so it is deleted rather than left as a second way to do the same thing.mirrorrefuses are exactly the onesstamp_readfound no made key for and returned on (itskey != 0guard), so the set of stamped textures is identical.descriptor.rs,make_read), against the world's 1,300–14,400 written slots a frame quoted in that file's own comment.ViewisClonebut notCopy, so the placed-texture upgrade clones rather than moves; that is the only new clone, and it replaces a dropped one.Verification
Intel Arc B580, Windows 11:
cargo test -p victory-gpu --lib --locked -- --test-threads=1→ 229 passed, 2 failed, 1 ignored. The two failures are the known Intel heap-cap pair (descriptor::host::tests::dynamic_slots_are_held_until_released,memory::tests::lists_share_a_table_and_copies_keep_their_views— #1744/#1829) that pristinemain63bcca4also fails on this card.cargo clippy -p victory-gpu --all-targets -- -D warningsclean with and without thediagnosticsfeature.No game data used; synthetic tests only.
Stacked on nothing: branched from
main63bcca4, two files, +13/−10. The magnitude is modelled from the slot rate × the two lock pairs and clone it removes, not measured — that needs a world frame with the title.claiming: GPU: descriptor::make_read resolves every read slot twice (mirror, then stamp_read, each taking the made lock and the global VIEWS lock and cloning the view) — resolve once per slot and pass the view to the stamp, with a ReadSlots counter so the frame line can price it
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T13:27:48Z.
Review: APPROVED
Verified on RTX 5090 against
origin/main(63bcca4):cargo test -p victory-gpu --lib descriptor::host:: -- --test-threads=1 --skip dynamic_slots_are_held_until_released: 14/14 passed.cargo test -p victory-gpu --lib draw:: -- --test-threads=1: 20/20 passed.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Cleanly avoids resolving each read slot twice.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by Jackster on 2026-11-26T22:29:01Z.
Windows 11,
63bcca4+ this PR, Radeon RX 7900 XTX (gfx1100, 32.0.32029.2010):cargo test -p victory-gpu --lib: 231 passed / 0 failed / 1 ignored (same as main).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.No test added.
stamp_readhas no callers left (the crate builds), and the read-mark, eviction and descriptor-host tests that go throughmirrorpass. The new signature takes the viewmirroralready resolved, so the made-key lock and the global view lock are not taken a second time per read slot. Synthetic only. AI-assisted.Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-27T00:28:29Z.
Review: APPROVED
Reviewed and tested
904b34804d48d4a60b84f76aa6443ee2f0a63876on both RTX 5090 and WARP (VICTORY_D3D12_DEBUG=1).Checked every return path of
HostHeap::mirror(crates/victory-gpu/src/descriptor/host.rs:722-833): out-of-range and empty/released slots returnNone, while the fast path, concurrent-rewrite retry path, and freshly mirrored/remade path all returnSome(view). Passing that view straight intostamp_read_view(&view)preserves exact behavior (includingplaced_textureresolution) while cutting out a redundantmadelock, globalVIEWSlock, andview_atlookup per read slot.Checks run:
cargo xtask policy— passcargo clippy --tests -p victory-gpu -- -D warnings(default and--features diagnostics) — cleanVICTORY_D3D12_DEBUG=1):descriptor::(21/21 excluding the pre-existingdynamic_slots_are_held_until_releasedbaseline failure) andhost::tests::textures_read_every_frame_stay_and_title_lists_stamp_theirs— pass with 0 Debug Layer errorsVICTORY_D3D12_WARP=1,VICTORY_D3D12_DEBUG=1):descriptor::(22/22) andhost::tests::textures_read_every_frame_stay_and_title_lists_stamp_theirs— pass with 0 Debug Layer errors.LGTM!
Imported from Marvisak/VIctory. Originally posted by borosf on 2026-11-27T06:38:44Z.
Thank you — RX 7900 XTX,
63bcca4+ this PR: 231 passed / 0 failed / 1 ignored (same as main) and clippy clean in-D warningsis exactly the check I could not run on this card (Arc B580), so it is useful to have.Agreed on the test:
stamp_readhas no callers left, and the change only removes a second lock-and-lookup for a viewmirroralready resolved, so the coverage that matters is the existing read-mark, eviction and descriptor-host tests, which you ran. Synthetic only, no game data.Imported from Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-27T14:25:59Z.
Tested in game together with #3262 (both merged cleanly) on an RTX 5090 (driver 620.73.04), Linux, GE-Proton11-14 Wine with its vkd3d-proton, GTA VI's opening prison yard, on
mainplus the unmerged PRs this setup needs (listed in #3425). 420 s runs, medians of the last 30 frame-rate lines, against three adjacent controls of the same base:No measurable change in frame or preparing time here: whatever the two save is below our run-to-run spread (a few ms). No crash, same pictures. Not a reason against either; the work they remove is real, just small on this scene.
AI-assisted (Claude); measured on my machine, no game data shared.
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.