gpu: depth-test-only draws leave the depth twin alone; held texture slots by a flag bit #2770
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2770"
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?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by LouisRiverstone on 2026-11-29T17:07:35Z.
Why
Two costs that leave the picture unchanged and land hardest on smaller cards.
Depth twins copied after depth-test-only draws.
draw.rscalledtwin_use(depth, false, true)for every draw with a depth target. Thetwin_usecomment names this shortcut: "every depth target bound for a draw counts as written (also when the draw only tests)". For a depth texture that shaders also write, each such draw marked the colour twin as behind, and its next use copied the whole texture again. Transparent surfaces and decals are the usual case: they test depth and do not write it.A hash lookup per queued slot under the texture queue's lock.
TextureQueue::collect_due_and_censuscalledself.held.get(&e.index)for every slot that was not yet due, with the queue's lock held.heldfills when the card has no room left, which is the normal state on 8 GB cards.findings.md(RTX 5090 D) names this lock as the most contended one.What changed
pipeline/host.rs:HostPipeline::writes_depth, computed from the title's depth-stencil state. It is true when the depth test is on with the write mask set to all, or when the stencil test is on with a non-zero write mask. The host PSO takesg.depthunchanged (DepthStencilState: g.depth), so the field matches what the card does. Compute pipelines getfalse.draw.rs: a draw counts as writing depth only when its view is not read-only (depth_state != DEPTH_READ) andp.writes_depthis true.descriptor/host.rs: a new entry flag,FLAG_HELD.holdsets it androomclears it. A new write already puts a fresh entry with flags 0, so the bit stands for "heldmaps this slot to this entry's write", and the due scan tests the bit instead of the map.Tests
a_pipeline_writes_depth_only_when_its_state_cancovers seven depth/stencil combinations.dense_texture_queue_invariants_and_cold_mapsnow checks at every step that the bit matchesheld. It also covers a slot written again while it is held.cargo test -p victory-gpu --lib: 913-915 passed. One to three failures per run, and which ones changes between runs (card_steps,menu,uav_pool,watch); none is in a file this PR touches.uav_poolandwatchfailures pass on their own, three runs in a row.mainfails in the same group (menu,card_steps).CI
maindoes not pass clippy at the moment:victory-shaderon unused imports (emit/lower/analysis.rs:6,emit/lower.rs:594);--all-featuresbuild does not compile, with errors inhost.rsandcopystat.rs.This PR does not touch those, so CI will fail on them. Running clippy without
-D warnings, the only warning in the touched files ismirror_for_passnever used (descriptor/host.rs:4598), which was there before.Not verified
Neither change has been run in game or measured. To check them in a
diagbuild:VICTORY_VRAM_BUDGET_MB).The depth change should be checked against screenshots of scenes with depth-read passes (water, decals, particles).
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by dyshay on 2026-11-29T17:49:04Z.
Merged into our fork's integration branch for testing (dyshay/VIctory-NVIDIA, branch
janus-prs). I read the full diff first: no network access, process spawning, binaries, build or dependency changes, or game data. It builds with--profile diag --features diagnostics, and the CPU tests of the touched crates pass. Runs on an RTX 4090 are queued (Series S with ray tracing, and Series X, DLSS Quality). Frame times will follow here.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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.