Repository navigation
Conversation
… submissions In Host::submit(), every command list's `run_deferred()` ran before `ExecuteCommandLists(&lists)` executed any of them. Both `texture::upload()` and `texture::card_writes()` queued `on_demand.uploaded()` / `on_demand.card_wrote()` (which execute `ID3D12CommandQueue::UpdateTileMappings`) via `list.defer_host()`. When a multi-list submission `[List 0, List 1]` sampled a tiled texture in `List 0` and mapped recycled heap tiles onto that texture in `List 1`, `List 1`'s `UpdateTileMappings` ran on the command queue ahead of `List 0`, exposing uninitialized recycled VRAM tiles from previous owners to `List 0` before `List 1`'s copy or zero-fill ran. Add `Step::Tiles` / `HostList::defer_tiles()` for queue-timeline tile mapping steps and use it from `texture::upload()` and `texture::card_writes()`. In `Host::submit()`, split `ExecuteCommandLists` before any `runs[k]` (`k > 0`) that has `Step::Tiles`, submitting preceding lists before running `runs[k]`'s tile mappings. When no subsequent list carries tile steps, submission remains a single `ExecuteCommandLists` call.
|
Tested on an RTX 2080 Ti (11 GB) + Windows 10, in the prologue up to the prison cell scene, with Setup: fork main
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, AI use: tested and written with Claude Code. |
Problem
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.)