GPU: pipelines that write depth only go first among early starts #2897

Open
github-bot wants to merge 2 commits from github-bot/gh-2897 into main AGit
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 23:21 UTC · original
0xkn0wh3r3:gpu/depth-only-pipelines-first-among-early-builds → main · +92 −6 · 2 files · 2 commits · open

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_only and its queue test), built on this tree's QUEUES. Credited with Co-authored-by: DexNom.

Tested

  • New test 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.
  • The same test checks 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 made line:

  • 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=0 turns the depth-only queue off. To compare on one build:

  1. Clear the pipeline library, start the title, and note the counts on the last host pipelines all made line once the world is reached.
  2. Clear the library again and repeat with VICTORY_DEPTH_ONLY_FIRST=0.

Not tested

  • This is a scheduling heuristic and I haven't measured whether it helps. I can't run the title here, so the comparison above is for a tester.
**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 23:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/2897) `0xkn0wh3r3:gpu/depth-only-pipelines-first-among-early-builds` → `main` · +92 −6 · 2 files · 2 commits · open ## 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](https://github.com/DexNom/VIctory/commit/921d8d3b43b44f3a6ca4b44095edd3c4baf10a87) (`Queue.early_depth`, `GraphicsState::writes_depth_only` and its queue test), built on this tree's `QUEUES`. Credited with `Co-authored-by: DexNom`. ## Tested - New test `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. - The same test checks `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 made` line: - `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=0` turns the depth-only queue off. To compare on one build: 1. Clear the pipeline library, start the title, and note the counts on the last `host pipelines all made` line once the world is reached. 2. Clear the library again and repeat with `VICTORY_DEPTH_ONLY_FIRST=0`. ## Not tested - This is a scheduling heuristic and I haven't measured whether it helps. I can't run the title here, so the comparison above is for a tester.
Pipelines an earlier run drew with are started while the title loads
(early starts), in the order the title creates them, after those a draw
waits for. A shadow map's or depth prepass's pipeline feeds several
later draws of a frame, which wait for it too.

Early starts that write depth and no colour (no render target, a depth
format, depth writes on) now have a queue of their own, which the
workers take from after the one draws wait for and before the other
early starts.

Test: depth_only_pipelines_go_ahead_of_other_early_starts (queue_index
of a depth-only and of another early start, and of both waited for).

From DexNom/VIctory@921d8d3b43
(Queue.early_depth, GraphicsState::writes_depth_only), on this tree's
queues.

Co-authored-by: DexNom <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:16:58 +00:00
Which order of early starts helps is a question of what the world's
first frames wait for, with a cold pipeline library. The draws that
waited for their pipeline, the time they waited in all, and those whose
frame budget ran out first (drawn without it) are now counted from the
start and logged with each batch of pipelines made ("host pipelines all
made": draw_waits, draw_waited_ms, draws_without).
VICTORY_DEPTH_ONLY_FIRST=0 puts depth-only early starts back with the
others, so one build can be compared with and without the queue.

Test: depth_only_pipelines_go_ahead_of_other_early_starts also checks
the switch.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 04:30 UTC · original · edited 2026-11-26 07:23 UTC

Automated triage for the maintainers.

Needs work (unchanged). The new commit 5f82c56 in pipeline/make.rs adds DRAW_WAITS, DRAW_WAITED_US and DRAWS_WITHOUT, counted in wait. They are logged on the host pipelines all made line in drained. VICTORY_DEPTH_ONLY_FIRST=0 turns the depth-only queue off through the new queue_for. The counters read correctly: every wait is counted, and a draw that leaves without its pipeline is counted in draws_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

**@⁠Marvisak** on GitHub · 2026-11-26 04:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/2897#issuecomment-7182658749) · edited 2026-11-26 07:23 UTC <!-- victory-triage v1 head=5f82c5628daa4ec62b97288a3d27b01a840f8da9 verdict=needs-work at=2026-11-26T07:23:30Z --> Automated triage for the maintainers. **Needs work (unchanged).** The new commit `5f82c56` in `pipeline/make.rs` adds `DRAW_WAITS`, `DRAW_WAITED_US` and `DRAWS_WITHOUT`, counted in `wait`. They are logged on the `host pipelines all made` line in `drained`. `VICTORY_DEPTH_ONLY_FIRST=0` turns the depth-only queue off through the new `queue_for`. The counters read correctly: every wait is counted, and a draw that leaves without its pipeline is counted in `draws_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](https://claude.ai/code)_
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 07:05 UTC · original

Agreed, it's unmeasured. I can't run the title, so 5f82c56 makes it measurable instead:

  • Draw waits are counted from the start and logged with each batch of pipelines made, on the host pipelines all made line: draw_waits, draw_waited_ms, and draws_without (frame budget ran out, drawn without the pipeline).
  • VICTORY_DEPTH_ONLY_FIRST=0 turns 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.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 07:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/2897#issuecomment-7185094344) Agreed, it's unmeasured. I can't run the title, so 5f82c56 makes it measurable instead: - Draw waits are counted from the start and logged with each batch of pipelines made, on the `host pipelines all made` line: `draw_waits`, `draw_waited_ms`, and `draws_without` (frame budget ran out, drawn without the pipeline). - `VICTORY_DEPTH_ONLY_FIRST=0` turns 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.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2897/head:github-bot/gh-2897'
git switch 'github-bot/gh-2897'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2897'
git switch 'github-bot/gh-2897'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2897'
git switch 'github-bot/gh-2897'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2897'
git switch 'main'
git merge --squash 'github-bot/gh-2897'
git switch 'main'
git merge --ff-only 'github-bot/gh-2897'
git switch 'main'
git merge 'github-bot/gh-2897'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2897
No description provided.