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

Open
BrenoMazini wants to merge 2 commits from upstream-pr/525 into main
BrenoMazini commented 2026-12-03 01:07:31 +00:00 (Migrated from github.com)

Imported from readmet3xt-lab/foxhound. Originally posted by BrenoMazini on 2026-12-03T01:07:31Z.


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

<!-- greyfinch-sync:readmet3xt-lab/foxhound:issue:5617707753 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/pull/525). Originally posted by [BrenoMazini](https://github.com/BrenoMazini) on 2026-12-03T01:07:31Z. --- ## 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)
tillo88 commented 2026-12-04 00:47:10 +00:00 (Migrated from github.com)

Imported from readmet3xt-lab/foxhound. Originally posted by tillo88 on 2026-12-04T00:47:10Z.


@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.

<!-- greyfinch-sync:readmet3xt-lab/foxhound:comment:7397158897 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/pull/525#issuecomment-7397158897). Originally posted by [tillo88](https://github.com/tillo88) on 2026-12-04T00:47:10Z. --- @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.
BrenoMazini commented 2026-12-04 01:02:56 +00:00 (Migrated from github.com)

Imported from readmet3xt-lab/foxhound. Originally posted by BrenoMazini on 2026-12-04T01:02:56Z.


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.

<!-- greyfinch-sync:readmet3xt-lab/foxhound:comment:7397423556 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/pull/525#issuecomment-7397423556). Originally posted by [BrenoMazini](https://github.com/BrenoMazini) on 2026-12-04T01:02:56Z. --- 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.
tillo88 commented 2026-12-04 03:40:56 +00:00 (Migrated from github.com)

Imported from readmet3xt-lab/foxhound. Originally posted by tillo88 on 2026-12-04T03:40:56Z.


@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.

<!-- greyfinch-sync:readmet3xt-lab/foxhound:comment:7400337717 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/pull/525#issuecomment-7400337717). Originally posted by [tillo88](https://github.com/tillo88) on 2026-12-04T03:40:56Z. --- @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 cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/525:upstream-pr/525'
git switch 'upstream-pr/525'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/525'
git switch 'upstream-pr/525'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/525'
git switch 'upstream-pr/525'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/525'
git switch 'main'
git merge --squash 'upstream-pr/525'
git switch 'main'
git merge --ff-only 'upstream-pr/525'
git switch 'main'
git merge 'upstream-pr/525'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
readmet3xt-lab/foxhound!525
No description provided.