Decoration bakes no longer run the pass over every texture slot first #525

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

@⁠BrenoMazini on GitHub · 2026-12-03 01:07 UTC · original
BrenoMazini:bake-pass → main · +30 −1 · 2 files · 2 commits · open

What

Before each draw of the title's decoration bake, State::early_textures ran a pass that uploads textures picked by index. That pass got the bake's whole budget (VICTORY_BAKE_TEXTURES_MS, 1500 ms) and uploaded every slot due, often thousands at once. The bake itself samples only 11-16 slots.

This PR caps only that pass, with a new switch, VICTORY_BAKE_PASS_MS:

  • unset or 0: no general pass before a bake (the new default);
  • all: the whole bake budget, as before;
  • a number: at most that many milliseconds.

The rest of what a bake does is unchanged:

  • the uploads already in flight are still waited for first, with the whole budget;
  • after the (now skipped) pass and before the bake draw runs, the bake's own sources are still brought up to date (bring_bake_sources), also with the whole budget;
  • the slots the pass no longer uploads are uploaded by the per-frame pass of the following frames, as on any other frame.

The fallback path used when no host list can be made (headless tests) is not changed. The switch is added to the README's table of switches.

Why

In light scenes, where the game otherwise holds 30 fps, these bakes were the frame spikes of play.

Before and after

Setup: Ryzen 7 5700X, RTX 4070 SUPER, Series X profile, 3440x1440, DLSS performance, no frame generation. Two play sessions of my own, one before and one after. They are not replays of the same route, so the after session went through more bakes.

Version tested: a build of my fork based on v0.8.3.3 (main 7dbcdcb, the base of this PR).

  • The before and after builds differ only in this change. The before build ran the pass with the whole budget. The after build ran with VICTORY_BAKE_PASS_MS=0, which this PR makes the default.
  • Both builds also carried work from my fork that is not in this PR, and both ran with the same switches:
    • VICTORY_PORT_CONSTANTS=1, which is off by default upstream;
    • my fork's VICTORY_HOME=1, which keeps hot runs of the title's big buffer in the card's memory (not upstream);
    • the lock-free journal reads described in my comment on #472 (VICTORY_JOURNAL_MIRROR, not upstream).
  • The pass before a bake does not depend on any of these. Still, the numbers come from that setup, not from plain v0.8.3.3.
Before (pass with the whole budget) After (VICTORY_BAKE_PASS_MS unset)
Bakes in the session 16 256
Time of a bake 154-322 ms in the pass alone 1-4 ms in all
The worst bake 13 sources (3 already current); the pass uploaded ~8,100 of 10,458 due slots in 322 ms —
Longest frame in the second of a bake 305-438 ms not above the seconds without one
Longest frame minus the median, mean per 1 s line, seconds with a bake 91 ms 65 ms
The same, seconds without a bake 61 ms 69 ms
Bake sources brought up to date — 3,222; failed=0, not_mapped=0
  • Before, the seconds with a bake were 30 ms worse than the others. After, they are no worse.
  • The spikes left in the after session have other causes:
    • pipeline creation at startup;
    • the loading screen;
    • the first frame in the world, which has first binds and "the card has no room for more textures";
    • the variance of heavy scenes.
  • Visually, characters' skin and decorations looked as before, and there was no visible texture pop-in.

A replay-bench run (frames > 100 ms) would confirm this better than my two sessions.

Checks

  • cargo clippy --workspace --all-targets --locked -- -D warnings: clean.
  • The same check with --all-features: clean.
  • cargo test --workspace --locked: all pass.
  • cargo xtask policy: ok.

🤖 Generated with Claude Code

**@⁠BrenoMazini** on GitHub · 2026-12-03 01:07 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/525) `BrenoMazini:bake-pass` → `main` · +30 −1 · 2 files · 2 commits · open ## What Before each draw of the title's decoration bake, `State::early_textures` ran a pass that uploads textures picked by index. That pass got the bake's whole budget (`VICTORY_BAKE_TEXTURES_MS`, 1500 ms) and uploaded **every slot due**, often thousands at once. The bake itself samples only 11-16 slots. This PR caps only that pass, with a new switch, `VICTORY_BAKE_PASS_MS`: - unset or `0`: no general pass before a bake (the new default); - `all`: the whole bake budget, as before; - a number: at most that many milliseconds. The rest of what a bake does is unchanged: - the uploads already in flight are still waited for first, with the whole budget; - after the (now skipped) pass and before the bake draw runs, the bake's own sources are still brought up to date (`bring_bake_sources`), also with the whole budget; - the slots the pass no longer uploads are uploaded by the per-frame pass of the following frames, as on any other frame. The fallback path used when no host list can be made (headless tests) is not changed. The switch is added to the README's table of switches. ## Why In light scenes, where the game otherwise holds 30 fps, these bakes were the frame spikes of play. ## Before and after Setup: Ryzen 7 5700X, RTX 4070 SUPER, Series X profile, 3440x1440, DLSS performance, no frame generation. Two play sessions of my own, one before and one after. They are not replays of the same route, so the after session went through more bakes. Version tested: a build of my fork based on **v0.8.3.3** (main `7dbcdcb`, the base of this PR). - The before and after builds differ only in this change. The before build ran the pass with the whole budget. The after build ran with `VICTORY_BAKE_PASS_MS=0`, which this PR makes the default. - Both builds also carried work from my fork that is not in this PR, and both ran with the same switches: - `VICTORY_PORT_CONSTANTS=1`, which is off by default upstream; - my fork's `VICTORY_HOME=1`, which keeps hot runs of the title's big buffer in the card's memory (not upstream); - the lock-free journal reads described in my comment on #472 (`VICTORY_JOURNAL_MIRROR`, not upstream). - The pass before a bake does not depend on any of these. Still, the numbers come from that setup, not from plain v0.8.3.3. | | Before (pass with the whole budget) | After (`VICTORY_BAKE_PASS_MS` unset) | |---|---|---| | Bakes in the session | 16 | 256 | | Time of a bake | 154-322 ms in the pass alone | 1-4 ms in all | | The worst bake | 13 sources (3 already current); the pass uploaded ~8,100 of 10,458 due slots in 322 ms | — | | Longest frame in the second of a bake | 305-438 ms | not above the seconds without one | | Longest frame minus the median, mean per 1 s line, seconds with a bake | 91 ms | 65 ms | | The same, seconds without a bake | 61 ms | 69 ms | | Bake sources brought up to date | — | 3,222; `failed=0`, `not_mapped=0` | - Before, the seconds with a bake were 30 ms worse than the others. After, they are no worse. - The spikes left in the after session have other causes: - pipeline creation at startup; - the loading screen; - the first frame in the world, which has first binds and "the card has no room for more textures"; - the variance of heavy scenes. - Visually, characters' skin and decorations looked as before, and there was no visible texture pop-in. A replay-bench run (frames > 100 ms) would confirm this better than my two sessions. ## Checks - `cargo clippy --workspace --all-targets --locked -- -D warnings`: clean. - The same check with `--all-features`: clean. - `cargo test --workspace --locked`: all pass. - `cargo xtask policy`: ok. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Before each draw of the title's decoration bake, the pass that uploads textures
picked by index ran with the bake's whole budget (VICTORY_BAKE_TEXTURES_MS, 1500)
and uploaded every slot due, thousands at once: 8,100 slots and 322 ms before a
bake that picks 13 sources, 154 ms before another. Those were the frame spikes
of play in light scenes.

The bake's own sources are brought up to date right after it in any case
(bring_bake_sources), and the uploads ahead are still waited for; the rest of
the queue is uploaded by the pass of the frames after, as every frame.

VICTORY_BAKE_PASS_MS caps that pass: unset or 0, no pass (the default now);
`all`, the whole bake budget as before; a number, that many milliseconds.

Measured in a session without the pass: 256 bakes of 1-4 ms each, 3,222 sources
brought up to date and none failed, frames with bakes no longer longer than
those without, and characters and textures as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-03 01:11:55 +00:00
Author
Owner

@⁠tillo88 on GitHub · 2026-12-04 00:47 UTC · original

@⁠BrenoMazini

Replay-bench measurement: no measurable fps difference on v0.8.3.3; frames > 100 ms at the low end of the release's range

Measured: PR head 4eddbe5 merged onto release v0.8.3.3 (same code as main 7dbcdcb), with the PR's new default (VICTORY_BAKE_PASS_MS not set), 2 measured runs (after a warm-up run that is not counted), against 11 runs of v0.8.3.3 without the PR, same route (~6.5 min).

run fps CPU prep ms median ms p95 ms p99 ms frames > 100 ms
release (11 runs, mean; fps range 36.15-37.12) 36.54 19.54 28.52 39.49 47.01 15.2 (range 8-32, median 13)
PR #525 run 1 36.68 19.75 28.80 37.95 44.64 9
PR #525 run 2 36.68 20.04 28.30 38.09 44.62 9

Mean fps: release 36.54, PR 36.68 (+0.4%): no measurable difference in frame rate. Frames over 100 ms: 9 in both PR runs, fewer than in 10 of the 11 release runs but inside the release's range (8-32); p99 was slightly below every release run (44.6 vs 44.88-60.01 ms), p95 inside the release's range. With 2 runs this is an observation, not a settled result. The bench does not tell how many bakes this route goes through.

Crashes: none in the PR runs and none in the release runs (no host GPU failure, no device lost).

Config: RTX 5070 Ti 16 GB, Ryzen 7 9800X3D, 32 GB, Windows 11; default play-foxhound.ps1 settings (Series X profile, 1440p, DLSS balanced, no frame generation), fullscreen, no frame cap.

Update: measured again on v0.8.3.5 (5e44415), same PR head 4eddbe5, 2 runs against 5 release runs.

run fps CPU prep ms median ms p95 ms p99 ms frames > 100 ms
release v0.8.3.5 (5 runs, mean; fps range 36.45-37.23) 36.76 18.98 28.28 38.79 45.56 14.4 (range 12-17)
PR #525 run 1 36.85 19.55 28.30 38.46 45.31 12
PR #525 run 2 36.15 19.90 29.30 39.15 45.77 11

Mean fps 36.50 (-0.7%): no measurable difference. Frames over 100 ms: 12 and 11, at and just below the low end of the release's 12-17; p95 and p99 inside the release's range. So on v0.8.3.5 the fewer long frames seen on v0.8.3.3 show only weakly. Run 1 logged the layer's once-per-process warning "a queue still stood at a wait at a present: it was not met" (forced present path in crates/victory-gpu/src/queue/behind.rs); it does not appear in any other log of this bench (about 140 logs since 2 Dec, release and PRs). One occurrence, so it may well be timing; noted in case it matters. No crashes on v0.8.3.5 either.

Measured unattended on a replay bench (same save, recorded controller input); numbers and text prepared with Claude.

**@⁠tillo88** on GitHub · 2026-12-04 00:47 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/525#issuecomment-7397158897) @⁠BrenoMazini **Replay-bench measurement: no measurable fps difference on v0.8.3.3; frames > 100 ms at the low end of the release's range** Measured: PR head `4eddbe5` merged onto release **v0.8.3.3** (same code as main `7dbcdcb`), with the PR's new default (`VICTORY_BAKE_PASS_MS` not set), 2 measured runs (after a warm-up run that is not counted), against 11 runs of v0.8.3.3 without the PR, same route (~6.5 min). | run | fps | CPU prep ms | median ms | p95 ms | p99 ms | frames > 100 ms | |---|---|---|---|---|---|---| | release (11 runs, mean; fps range 36.15-37.12) | 36.54 | 19.54 | 28.52 | 39.49 | 47.01 | 15.2 (range 8-32, median 13) | | PR #525 run 1 | 36.68 | 19.75 | 28.80 | 37.95 | 44.64 | 9 | | PR #525 run 2 | 36.68 | 20.04 | 28.30 | 38.09 | 44.62 | 9 | Mean fps: release 36.54, PR 36.68 (+0.4%): **no measurable difference** in frame rate. Frames over 100 ms: 9 in both PR runs, fewer than in 10 of the 11 release runs but inside the release's range (8-32); p99 was slightly below every release run (44.6 vs 44.88-60.01 ms), p95 inside the release's range. With 2 runs this is an observation, not a settled result. The bench does not tell how many bakes this route goes through. Crashes: none in the PR runs and none in the release runs (no host GPU failure, no device lost). Config: RTX 5070 Ti 16 GB, Ryzen 7 9800X3D, 32 GB, Windows 11; default `play-foxhound.ps1` settings (Series X profile, 1440p, DLSS balanced, no frame generation), fullscreen, no frame cap. **Update: measured again on v0.8.3.5** (`5e44415`), same PR head `4eddbe5`, 2 runs against 5 release runs. | run | fps | CPU prep ms | median ms | p95 ms | p99 ms | frames > 100 ms | |---|---|---|---|---|---|---| | release v0.8.3.5 (5 runs, mean; fps range 36.45-37.23) | 36.76 | 18.98 | 28.28 | 38.79 | 45.56 | 14.4 (range 12-17) | | PR #525 run 1 | 36.85 | 19.55 | 28.30 | 38.46 | 45.31 | 12 | | PR #525 run 2 | 36.15 | 19.90 | 29.30 | 39.15 | 45.77 | 11 | Mean fps 36.50 (-0.7%): **no measurable difference**. Frames over 100 ms: 12 and 11, at and just below the low end of the release's 12-17; p95 and p99 inside the release's range. So on v0.8.3.5 the fewer long frames seen on v0.8.3.3 show only weakly. Run 1 logged the layer's once-per-process warning "a queue still stood at a wait at a present: it was not met" (forced present path in `crates/victory-gpu/src/queue/behind.rs`); it does not appear in any other log of this bench (about 140 logs since 2 Dec, release and PRs). One occurrence, so it may well be timing; noted in case it matters. No crashes on v0.8.3.5 either. Measured unattended on a replay bench (same save, recorded controller input); numbers and text prepared with Claude.
Author
Owner

@⁠BrenoMazini on GitHub · 2026-12-04 01:02 UTC · original

Thank you for measuring this on both releases, and for being careful about what two runs can and can't show.

I agree with your reading: no measurable change in frame rate. I should have said more clearly in the PR that this is what to expect. The change only touches the frames in which a decoration bake runs. In my sessions those were few, mostly in light scenes, where each bake's pass took 154-322 ms and caused the spikes. Over a whole route they barely move the average. Your frames over 100 ms are the closer measure, and as you say, with two runs they are only a hint. On a 9800X3D the pass is probably also much shorter than on my 5700X, which would make it even harder to see.

About the warning "a queue still stood at a wait at a present: it was not met": thank you for noting it. It comes from the submission queue's present path, which this PR doesn't change, so I'd also guess timing, but I can't rule it out from here. For what it's worth, I searched the 27 logs I kept from my runs on 3 December. All of them are from builds that include this PR, with VICTORY_BAKE_PASS_MS=0 and VICTORY_ASYNC_SUBMIT on, and the warning appears in none. I'll keep watching for it.

If it would help, I can count the bakes and their times in a session from my logs and post them here, so there is at least a number for how often the change applies.

**@⁠BrenoMazini** on GitHub · 2026-12-04 01:02 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/525#issuecomment-7397423556) Thank you for measuring this on both releases, and for being careful about what two runs can and can't show. I agree with your reading: no measurable change in frame rate. I should have said more clearly in the PR that this is what to expect. The change only touches the frames in which a decoration bake runs. In my sessions those were few, mostly in light scenes, where each bake's pass took 154-322 ms and caused the spikes. Over a whole route they barely move the average. Your frames over 100 ms are the closer measure, and as you say, with two runs they are only a hint. On a 9800X3D the pass is probably also much shorter than on my 5700X, which would make it even harder to see. About the warning "a queue still stood at a wait at a present: it was not met": thank you for noting it. It comes from the submission queue's present path, which this PR doesn't change, so I'd also guess timing, but I can't rule it out from here. For what it's worth, I searched the 27 logs I kept from my runs on 3 December. All of them are from builds that include this PR, with `VICTORY_BAKE_PASS_MS=0` and `VICTORY_ASYNC_SUBMIT` on, and the warning appears in none. I'll keep watching for it. If it would help, I can count the bakes and their times in a session from my logs and post them here, so there is at least a number for how often the change applies.
Author
Owner

@⁠tillo88 on GitHub · 2026-12-04 03:40 UTC · original

@⁠BrenoMazini

Correction to my note on the "a queue still stood at a wait at a present: it was not met" warning

I wrote above that this warning appeared only in run 1 of this PR and in no other log of the bench. That no longer holds: it has since appeared once in a run without this PR, the warm-up run of release v0.8.3.5 with only VICTORY_GUARD_PAGES=1 and VICTORY_GUARD_PAGES_MOST=4 set (no PR merged). So it is not tied to this PR; it shows up rarely on this route with or without it (2 of 168 logs on this bench). The rest of the measurement above is unchanged.

Measured unattended on a replay bench (same save, recorded controller input); numbers and text prepared with Claude.

**@⁠tillo88** on GitHub · 2026-12-04 03:40 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/525#issuecomment-7400337717) @⁠BrenoMazini **Correction to my note on the "a queue still stood at a wait at a present: it was not met" warning** I wrote above that this warning appeared only in run 1 of this PR and in no other log of the bench. That no longer holds: it has since appeared once in a run **without this PR**, the warm-up run of release v0.8.3.5 with only `VICTORY_GUARD_PAGES=1` and `VICTORY_GUARD_PAGES_MOST=4` set (no PR merged). So it is not tied to this PR; it shows up rarely on this route with or without it (2 of 168 logs on this bench). The rest of the measurement above is unchanged. Measured unattended on a replay bench (same save, recorded controller input); numbers and text prepared with Claude.
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/525/head:github-bot/gh-525'
git switch 'github-bot/gh-525'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-525'
git switch 'github-bot/gh-525'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-525'
git switch 'github-bot/gh-525'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-525'
git switch 'main'
git merge --squash 'github-bot/gh-525'
git switch 'main'
git merge --ff-only 'github-bot/gh-525'
git switch 'main'
git merge 'github-bot/gh-525'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.