GPU: pipelines that write depth only go first among early starts #2895
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2897"
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 Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-25T23:21:30Z.
What
Pipelines an earlier run drew with are started while the title loads (early starts), in the order the title creates them, after the pipelines draws are waiting for. A shadow map's or depth prepass's pipeline feeds several later draws in a frame, and those draws wait for it too.
Early starts that write depth and no colour now get a queue of their own. That means no render target, a depth format, and depth writes on (
GraphicsState::writes_depth_only). Workers take from it after the queue draws wait for and before the other early starts (queue_index). Draws that are waiting still come first.Where it came from
From DexNom's fork, DexNom/VIctory@921d8d3 (
Queue.early_depth,GraphicsState::writes_depth_onlyand its queue test), built on this tree'sQUEUES. Credited withCo-authored-by: DexNom.Tested
pipeline::make::tests::depth_only_pipelines_go_ahead_of_other_early_starts: an early start that writes depth only goes in queue 1, another early start in queue 2, and either one, when a draw waits for it, in queue 0.VICTORY_DEPTH_ONLY_FIRST=0: a depth-only early start then goes in queue 2 with the others.cargo test -p victory-gpu(Windows 11, RTX 5070 Ti): 230 passed. The 2 known NVIDIA failures are fixed by #2121.cargo clippy -p victory-gpu --all-targets -- -D warnings, with and without--features diagnostics: clean.Measuring it
Draw waits for pipelines are counted from the start and logged with each batch of pipelines made, on the
host pipelines all madeline:draw_waits: draws that waited for their pipeline;draw_waited_ms: the time they waited in all;draws_without: draws whose frame budget ran out first, so they were drawn without the pipeline.VICTORY_DEPTH_ONLY_FIRST=0turns the depth-only queue off. To compare on one build:host pipelines all madeline once the world is reached.VICTORY_DEPTH_ONLY_FIRST=0.Not tested
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T23:32:25Z.
Review: COMMENTED
Verified head
a3ea016ecleanly on top oforigin/main(842b0cb7) on Windows 11 x64 (NVIDIA GeForce RTX 5090).Code Review
0: draw-awaited,1: depth-only early starts,2: other early starts) dequeues deterministically viaqueues.iter_mut().find_map(VecDeque::pop_front)with FIFO within each tier. Promoting an already-queued early start when a draw waits (enqueue(p, true)) cleanly skips the stale lower-tier entry viap.takenwithout duplicate compilation.GraphicsState::writes_depth_onlyaccurately checksNumRenderTargets == 0 && depth_format != DXGI_FORMAT_UNKNOWN && DepthEnable && DepthWriteMask == ALL, while non-stream graphics pipelines (graphics = None) fall into tier 2.Local Verification
cargo test --locked -p victory-gpu pipeline: 26/26 passed (includingpipeline::make::tests::depth_only_pipelines_go_ahead_of_other_early_starts).cargo clippy --locked -p victory-gpu --tests -- -D warnings(default and--features diagnostics): clean.cargo xtask policy:191 files ok.Looks clean and ready to merge.
Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T23:35:04Z.
Review: COMMENTED
Sound prioritization: writes_depth_only correctly identifies shadow-map/depth-prepass pipelines (no RTs, depth enabled, full write mask), and queueing them ahead of other early starts shortens the critical path for dependent draws without changing wait-for ordering. LGTM.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T04:30:44Z.
Automated triage for the maintainers.
Needs work (unchanged). The new commit
5f82c56inpipeline/make.rsaddsDRAW_WAITS,DRAW_WAITED_USandDRAWS_WITHOUT, counted inwait. They are logged on thehost pipelines all madeline indrained.VICTORY_DEPTH_ONLY_FIRST=0turns the depth-only queue off through the newqueue_for. The counters read correctly: every wait is counted, and a draw that leaves without its pipeline is counted indraws_without.Thank you for making it measurable. The verdict still depends on the measurement, though: a cold-library run each way with the three counts from the last line. Once those numbers are posted here, this can be judged on the result. If the depth-only queue is kept, the comparison switch could be dropped then.
CI: passing.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-26T07:05:57Z.
Agreed, it's unmeasured. I can't run the title, so
5f82c56makes it measurable instead:host pipelines all madeline:draw_waits,draw_waited_ms, anddraws_without(frame budget ran out, drawn without the pipeline).VICTORY_DEPTH_ONLY_FIRST=0turns the depth-only queue off, so one build can be compared both ways.A tester could clear the pipeline library, reach the world, and note the last line's counts. Then clear it again and repeat with
VICTORY_DEPTH_ONLY_FIRST=0. If anyone can run that, the numbers would settle it. Until then I'm not claiming a gain, and I understand if this stays open.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.