draw: reuse State allocations across reset, cache target state sync, and stack-allocate RTVs #390
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/trustno1-coder--VIctory-NVIDIA!390
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-390"
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?
@Wiktorxd-1 on GitHub · 2026-11-27 21:50 UTC · original
Wiktorxd-1:perf/reduce-dropped-and-cpu→main· +83 −14 · 1 files · 2 commits · openWhat this fixes
On heavy frames,
victory_gpu::list::thinspends significant CPU time across worker threads replaying ~26k–40k commands/frame across ~224 command lists/frame:draw::State::resetdid*self = State::default(), dropping allVecandHashMapheap capacities (graphics,compute,targets,target_handles,viewports,scissors,ambient_tables,fresh_tables,root_srv_slots,root_uav_slots) on every list reset.draw::State::prepare_forcalledensure_state(resource::host_copy+HostList::statesmutex lock) for every bound render target and depth buffer on every consecutive draw, even when targets/depth had not changed since the previous draw.draw::State::set_targetsallocated aVec<D3D12_CPU_DESCRIPTOR_HANDLE>forOMSetRenderTargetson every target change (even though D3D12 has at most 8 RTVs).I can't give a clean 3D-scene fps delta yet: the local launch test (
35s, Series S, DLSS Performance, FG 6x) verified clean startup and rendering (warns=0,crashes.log=False) without loading into a heavy 3D save.The commits
draw::Stateallocations acrossresetand cache target state sync.State::resetdrainsself.dynamicviacrate::descriptor::release_dynamic(preservingDropsemantics) and.clear()s allVec/HashMapfields in place instead of reallocating.targets_synced: boolandlast_depth_state: u32onState(invalidated inreset,set_targets, andsynced) soprepare_forskips redundantensure_statecalls on back-to-back draws to the same targets/depth state (still respectingTESTED_DEPTHread-state transitions).set_targets.[D3D12_CPU_DESCRIPTOR_HANDLE; 8]on the stack for<= 8render targets instead of collecting into aVec.Tests
cargo test --locked -p victory-gpu --lib draw(11 passed; 0 failed; 3 ignored)cargo build --release --locked -p victory(succeeded)target\release\victory.exeviascripts\play-nvidia.ps1(35s,warns=0,crashes.log=False).Setup
NVIDIA GeForce RTX 5070, driver
621.14.0, Windows 11 (10.0.26300). Series S profile, DLSS Performance, Frame Generation 6x. My own dump:<game dir>. No game files are attached or quoted.This change and its testing were done with an AI assistant (Antigravity), and I checked the results on my machine.
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.