GPU/host: preserve UpdateTileMappings order across multi-list submissions #784
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/fxceless--victory-fork!784
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-784"
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?
@AscilCH on GitHub · 2026-11-25 07:35 UTC · original
AscilCH:fix/gpu-host-tile-mappings-multi-list-order→main· +383 −11 · 2 files · 1 commits · openProblem
In
Host::submit(),list.run_deferred(&mut batch)ran for every command list inrunsbeforeself.queue.ExecuteCommandLists(&lists)executed any of them. Bothtexture::upload()andtexture::card_writes()queuedon_demand.uploaded()/on_demand.card_wrote()— which executeID3D12CommandQueue::UpdateTileMappingsimmediately on the queue — vialist.defer_host().When a multi-list submission
[List 0, List 1]read an unmapped/existing tiled texture inList 0and mapped recycled heap tiles onto that texture inList 1,List 1'sUpdateTileMappingsran on the command queue ahead ofList 0, exposing uninitialized recycled VRAM tiles from previous owners toList 0beforeList 1's copy or zero-fill ran.Fix
Step::TilesandHostList::defer_tiles()for queue-timeline tile-mapping callbacks, and use it fromtexture::upload()andtexture::card_writes().Host::submit(), partitionlistsviatile_segments()before any subsequent run (k > 0) that hasStep::Tiles, submitting preceding lists toself.queuebefore runningruns[k].run_tile_steps(). When no later list has tile steps, submission stays a singleExecuteCommandListscall.Verification
cargo test -p victory-gpu --locked -- host::batch:6 passed; 0 failed; 1 ignored(benchmark), including new unit testtile_segments_split_only_at_subsequent_tile_listsand real D3D12 hardware testdeferred_tile_mappings_on_second_list_do_not_expose_stale_vram_to_first_list(verifyingList 0reads0x00rather than recycled0xa5VRAM whileList 1writes and reads back0x3c).cargo clippy -p victory-gpu --all-targets --all-features --locked: 0 warnings inhost.rsandtexture.rs(only pre-existing8dd30abwarnings indraw.rs:2377andindirect.rs:1322).cargo xtask policy:171 files ok.(AI-assisted; synthetic unit tests only, no game data.)
@cafeoh on GitHub · 2026-11-25 07:54 UTC · original · edited 2026-11-25 07:57 UTC
Tested on an RTX 2080 Ti (11 GB) + Windows 10, in the prologue up to the prison cell scene, with
VICTORY_LEVELS_ON_DEMAND=1. This fixes a bug we saw in every run.Setup: fork main
a26859f+ #683, #644, #487, #606, #559, #701, #687, #142, then this PR (which also brought in main9376fd6). It merged with no conflicts. Same switches in every run (VICTORY_DEBUG_NULL_VIEWS=1,VICTORY_SKIP_BINK=1, every frame captured from the first cutscene on).So the noise was recycled tile memory, as the PR describes. With this PR the prison cell scene was also the cleanest we have had: no magenta on the walls, and correct lighting on the character's hair.
Frame times were about the same with and without the PR (about 0.4–1.0 s a frame on this card; the game's own timing line puts most of it in GPU work and copying back, and our picture capture adds about 60 ms a frame), so I saw no slowdown from the split submissions.
Tested: the first cutscene and the cell scene, 1 run with the PR against 5 without. Not tested: later scenes, the unit tests,
cargo clippy.AI use: tested and written with Claude Code.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.