gpu(native): snapshot descriptor table records when recording commands #546
No reviewers
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS!546
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-542"
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?
@Sheffy007 on GitHub · 2026-11-28 02:28 UTC · original
Sheffy007:fix/snapshot-recorded-table-entries→main· +759 −115 · 10 files · 1 commits · openSummary
[tag, index, generation]descriptor slot records of each boundRoot::Tablespan when recordingCmd::DispatchandCmd::Draw(snapshot_roots), rather than reading live title descriptor heap memory at submission time after the title may have unbound or overwritten entries used by an earlier command.mirrorthroughmirror_record(&heap, index, record)(anddescriptor::view_record) so submission-time mirroring, evicted-texture recreation (resources_named), typed buffer materialization (materialize_typed_buffers), UAV dirty-page tracking (note_written), and first-useview_strides/view_addressestables all read the command's recorded slot records, including null buffer SRVs/UAVs ({ addr: 0, size: 0 }) and null image views (clear_entry).index(cmd_may_read_entry) from clobbering heap entries claimed by earlier commands in that submission, and catch uprolled_backentries (sync_rolled_back) at the start of the next submission before bindless work runs.docs/native-host.mdand add unit and Metal GPU end-to-end tests covering intra-submission CBV/SRV unbinds, null-buffer-to-placed-buffer overwrites with next-submission bindless catch-up, and evicted texture recreation after unbind.Verification
cargo xtask policycargo test -p victory-gpu --lib --locked -- --test-threads=1cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warningscargo clippy --workspace --all-targets --all-features --locked --target x86_64-pc-windows-gnullvm -- -D warningsCloses #542
Refs #258
cc @Olima34
93ee6a8389to69a64d3bd6@Olima34 on GitHub · 2026-11-28 03:54 UTC · original · requested changes
Thanks @Sheffy007. Reading the records a command was recorded with, rather than whatever the heap holds at submission, is the D3D12 rule, and the tests (intra-submission unbinds, null-to-placed overwrite with the next-submission catch-up, evicted texture recreation) cover the cases well. We read the whole diff of
69a64d3bwhile helping the maintainer clear the queue. One thing is missing before it can merge:A cost measurement on the recording path.
snapshot_rootsnow runs at everydraw_callanddispatch. For each bound table it does onesafe_read(amach_vm_read_overwritesystem call on macOS) of up to the table's checked span, plus aVecand anRc<[_]>allocation. All of that runs on the title's command-list recording thread, before submission, and comes on top of the readsremirror_tablesalready does at submission. A world frame records thousands of draws and dispatches with two or more tables each, so this could be several thousand extra system calls a frame. World frame rate is one of the project's three goals right now, and the PR only lists unit and clippy checks.Could you post a before/after from a world run?
tools/macos/run-summary.sh --compareof two headless runs of the same length would do, fps per 64 frames plusVICTORY_SUBMIT_TIMING=1if you can. If the cost shows, two cheaper options: reuse the previous command's snapshot when the table base and the span's bytes are unchanged, or snapshot only spans the title wrote since the last record. Either would keep the semantics.Smaller: the Windows
safe_read(ReadProcessMemory) is fine, but say in the description why it's needed here (the snapshot reaches it on the Windows build too, we assume), so it doesn't read as unrelated.CI is green on this head. No game run on our side.
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.