Repository navigation
Conversation
…ke, and raw zeroing Fix two cache-invalidation bugs in `HostHeap::mirror_copied` / `HostHeap::mirror` / `HostHeap::texture_slot_gone` (`crates/victory-gpu/src/descriptor/host.rs`): 1. Stale `self.copied` fingerprint across API writes and `unmake`: `self.copied[index]` was updated only by `mirror_copied()` and never cleared when `mirror()` (via `Create*View`/`CopyDescriptors`), `texture_slot_gone()`, or stale placed-texture `unmake()` overwrote or nulled a slot. Copying record A -> API write B -> raw-copy A (or raw-copy A -> `unmake` -> raw-copy A) hit `*last == print` and left the host slot permanently stuck on B or NULL. Invalidate `self.copied[index]` (outside the `self.made` lock to preserve lock order) whenever `mirror()` or `unmake()` modifies or clears a slot. 2. Raw zeroing of an API-created slot skipped: When a slot was written via API (`made[index] != 0`, `copied[index] == 0`) and later cleared by raw zeroing, `*last == 0 && all_zero` returned `false` without checking `made[index]`, leaving the old host descriptor alive and pinning its `Kept` GPU resource. Check `made[index]` before skipping. Add `descriptor::tests::copied_fingerprint_invalidates_across_api_writes_unmake_and_zeroing`.
|
Independent Proton result on an RTX 5060 Laptop GPU (8 GB), NVIDIA 615.78.08, Bazzite 44, Proton Experimental 11.0-20261112, and vkd3d-proton 3.1.0. Windows MSVC release tests were cross-built with Rust 1.98.1. I applied the same synthetic fenced D3D12 sampler fixture and #20's DXC support to parent
The PR’s existing OpenAI Codex (GPT-6.2-Sol) adapted and ran the tests and drafted this report. |
|
Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head AI-assisted (Claude Code); no game data. |
|
Follow-up to my test report above, with where the crash is and what I checked (RX 6950 XT, Windows 11, this PR's head Where. The crash is deterministic: Why, as far as I can tell. The heap in this test is a sampler heap ( What I checked. With a local guard Two ways out. Run scenario C against a Nothing here touches the title. AI-assisted (Claude Code); no game data. |
|
A note for the rebase onto a253706, found while carrying this PR on a branch of ours. a253706 replaced the heap sync with What made it pass here: the page pass collects the slots it found zeroed and checks them against (Found and fixed on our branch with Claude Code; not run in the game on its own.) |
Summary
Fixes two cache-invalidation bugs in
HostHeap::mirror_copied(crates/victory-gpu/src/descriptor/host.rs), complementary to #792 (which addresses themirror_copiedTOCTOU re-read separately):Stale
HostHeap::copiedfingerprint across API writes andunmake():self.copied[index]was previously written only bymirror_copied()and never cleared whenmirror()(called byCreate*View/CopyDescriptors),texture_slot_gone(), or stale placed-textureunmake()modified or nulled a slot.raw-copy A -> API write B -> raw-copy A(orraw-copy A -> unmake -> raw-copy A) matched*last == print(A)and skipped mirroring, leaving the host heap slot permanently stuck onBorNULL.self.copied[index]viaforget_copied()(always outside theself.madelock to avoid lock-order inversion) whenevermirror()orunmake()modifies or nulls a slot.Raw zeroing of an API-populated slot skipped:
When a slot was populated through D3D12 API calls (
made[index] != 0,copied[index] == 0) and later cleared by raw zeroing in guest memory,*last == 0 && all_zeroreturnedfalsewithout checkingmade[index], leaving the stale host descriptor active and pinning itsKeptGPU resource.*last == 0 && all_zero, checkself.made[index](outside theself.copiedlock) before skipping.Verification
descriptor::tests::copied_fingerprint_invalidates_across_api_writes_unmake_and_zeroingcovering:raw A -> API B -> raw AAPI A -> raw zeroingraw A -> texture_slot_gone unmake -> raw Acargo test -p victory-gpu --lib --locked -- descriptor::— 29 passed, 0 failed, 0 ignored.cargo clippy -p victory-gpu --all-targets --all-features --locked— 0 warnings incrates/victory-gpu/src/descriptor/host.rsandcrates/victory-gpu/src/descriptor.rs.cargo xtask policy— 171 files ok.(AI-assisted; synthetic unit tests only, no game data.)