Levels on demand that takes effect, a shader cache key for ray tracing, a hang on the present's fallback; a bus bench and an audit #1470

Merged
banaanpapa merged 8 commits from upstream-pr/1470 into main 2026-11-29 08:16:57 +00:00
banaanpapa commented 2026-11-28 20:24:06 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by banaanpapa on 2026-11-28T20:24:06Z.


Three fixes, one measurement tool and an audit. Each is a commit of its own and can be taken alone. None of it was run in the title: there is no dump on the PC this was made on.

1. Levels on demand never took effect with the texture pool on

What was wrong. host_texture_as(.., reserved = true) tried the pool of 64 MiB blocks before it looked at reserved, and the pool takes every texture the title fills, which is every texture levels on demand asks for. The texture came back placed in a block, Tiled::make found no tiles in it, and the old kind was made. VICTORY_TEXTURE_POOL is on by default, so VICTORY_LEVELS_ON_DEMAND=1 changed nothing for those textures.

The change. !reserved on the pool branch (resource.rs).

Shown by. a_texture_asked_for_without_memory_is_not_cut_from_a_block asks for a BC7 1024x1024 chain without memory and has the card cut it into tiles. On an RTX 5080 it failed before the change and passes after.

Bears on #1411, which turns levels on demand on by itself for budgets up to 8 GiB: without this it would turn on something that does nothing. The launchers still set the switch to 0, so nothing changes for a player until someone measures it.

2. Ray tracing on and off shared a shader cache key

What was wrong. victory play sets VICTORY_BVH_MISS=1 in every run. The F1 menu's RAY TRACING sets VICTORY_BVH_BUILDER=1 beside it, which turns the misses off inside the translator (intersect.rs bvh_miss). The key held the switch's value, 1 in both runs, so:

  • a run with RAY TRACING on was served the shaders cached without it: every ray missing structures that were now built;
  • a run with it off again was served what the run with it had translated: walks of memory nothing built.

The change. Where the switch is set, the key says which of the two the translator does (victory_shader::emit::bvh_miss). A start of victory.exe translates its shaders once more.

Also. Six switches the translator reads were in no key: VICTORY_LOOPS_WAVE, VICTORY_LDS_FIRST_INIT, VICTORY_LDS_INIT_HOIST, VICTORY_HDR_CLAMP, VICTORY_DEFRAG, VICTORY_SAMPLED_MARKS. VICTORY_DEFRAG=0 in particular did nothing wherever the program it leaves out was cached already. They are keyed only while set, so caches made without them stay valid. #1437 adds the first two to the always-keyed list; either way works, and they would conflict in a few lines.

A new test fails for any switch the translator's source reads that no list of the key names. Rebased onto 923e38c it found the last three of the six by itself.

Shown by. the_builder_beside_bvh_miss_changes_the_shader_cache_key (five settings, each in a process of its own), switches_keyed_when_set_change_the_shader_cache_key, every_switch_of_the_translator_is_keyed_or_known_not_to_matter.

3. A hang on the fallback paths of present_planes

What was wrong. Where the two-plane composer cannot be made, or cannot record, present_planes shows the base plane alone by calling itself. It dropped presenter first, which is a reference into the guard of Host::presenter, not the guard. The guard lived on and the call locked the same mutex again, which waits for ever. Clippy names all three places (drop of a reference does nothing).

The change. The guard is dropped.

Not run. The path needs a composer that fails. It compiles and the crate's tests pass.

4. A free lets go of what is in place there

title_memory_freed did not tell crate::inplace; only remaps did. The tables forget it now. This is half a fix: the heap itself goes when the last list and slot that hold it do, and until then the title's VirtualFree fails as it did. Nothing turns VICTORY_INPLACE on by default. No test of its own.

5. A bench of what the bus costs (host/bus.rs)

An ignored test, no title files:

cargo test -p victory-gpu --release --lib host::bus -- --ignored --nocapture

Shaders read and store a 256 MiB buffer in each placement between two timestamps of the card. RTX 5080, Ryzen 9 9950X3D, two runs within 1 %:

Where the buffer lies Shaders read Shaders store CPU copies in CPU copies out
The PC's memory (shared_buffer, pool L0) 32 GB/s 2.0 GB/s 31 GB/s 10 GB/s
The card's memory (uav_buffer) 932 GB/s 300 GB/s
Card memory the CPU maps (mapped_card_buffer) 940 GB/s 301 GB/s 32 GB/s 0.09 GB/s

The figures for the card's memory are lower bounds. It would be useful to have the same from other cards, AMD above all.

6. docs/unified-memory-audit.md

An audit of the tree at 32ecacf against the five-track plan of Marvisak/VIctory issue 3703, with what other trees measured of the ways round the bridge, the waits that are left on the submitting thread, textures, the PC's memory, shaders and pipelines, and a road in phases. Its line numbers are of 32ecacf; 205 commits have landed since, so check before relying on one. It makes no frame rate claim.

7. Small things

  • Clippy findings that 32ecacf had: shadow.rs, descriptor.rs, gameinput.rs, and one in victory-shader's tests.
  • Comments that said "off by default" for VICTORY_RELAY, VICTORY_LATE_WAIT, VICTORY_WIDE_BACK and VICTORY_ASK_ONCE, which are on; tiles.rs named a function that is called card_writes.

Tested

Windows 11 26300, RTX 5080 16 GB, driver 617.42, Rust 1.98.1, on 923e38c.

  • cargo test --workspace --locked: every test passes but xtask's repository_passes_policy, which fails on main the same way (emit/lower.rs: 667523 bytes exceeds the 655360-byte limit). victory-gpu 554 passed, 44 ignored; victory-shader 348 passed.
  • cargo clippy --workspace --all-targets --locked -- -D warnings does not pass, on main or here: two findings in emit/lower.rs and some dozen in victory-gpu, all from commits since 32ecacf, none in a line this changes.

Not verified

  • Nothing was run in the title. No frame rate, memory or picture claim is made for any of this.
  • Change 3 was not exercised; change 4 has no test.
  • The on-card run of levels_on_demand_on_the_card did not happen: it wants the D3D12 debug layer, which is not installed here. It passes on the software adapter.

🤖 Generated with [Claude Code]

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5544245414 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1470). Originally posted by [banaanpapa](https://github.com/banaanpapa) on 2026-11-28T20:24:06Z. --- Three fixes, one measurement tool and an audit. Each is a commit of its own and can be taken alone. None of it was run in the title: there is no dump on the PC this was made on. ## 1. Levels on demand never took effect with the texture pool on **What was wrong.** `host_texture_as(.., reserved = true)` tried the pool of 64 MiB blocks before it looked at `reserved`, and the pool takes every texture the title fills, which is every texture levels on demand asks for. The texture came back placed in a block, `Tiled::make` found no tiles in it, and the old kind was made. `VICTORY_TEXTURE_POOL` is on by default, so `VICTORY_LEVELS_ON_DEMAND=1` changed nothing for those textures. **The change.** `!reserved` on the pool branch (`resource.rs`). **Shown by.** `a_texture_asked_for_without_memory_is_not_cut_from_a_block` asks for a BC7 1024x1024 chain without memory and has the card cut it into tiles. On an RTX 5080 it failed before the change and passes after. **Bears on #1411**, which turns levels on demand on by itself for budgets up to 8 GiB: without this it would turn on something that does nothing. The launchers still set the switch to 0, so nothing changes for a player until someone measures it. ## 2. Ray tracing on and off shared a shader cache key **What was wrong.** `victory play` sets `VICTORY_BVH_MISS=1` in every run. The F1 menu's RAY TRACING sets `VICTORY_BVH_BUILDER=1` beside it, which turns the misses off inside the translator (`intersect.rs` `bvh_miss`). The key held the switch's value, `1` in both runs, so: - a run with RAY TRACING on was served the shaders cached without it: every ray missing structures that were now built; - a run with it off again was served what the run with it had translated: walks of memory nothing built. **The change.** Where the switch is set, the key says which of the two the translator does (`victory_shader::emit::bvh_miss`). A start of `victory.exe` translates its shaders once more. **Also.** Six switches the translator reads were in no key: `VICTORY_LOOPS_WAVE`, `VICTORY_LDS_FIRST_INIT`, `VICTORY_LDS_INIT_HOIST`, `VICTORY_HDR_CLAMP`, `VICTORY_DEFRAG`, `VICTORY_SAMPLED_MARKS`. `VICTORY_DEFRAG=0` in particular did nothing wherever the program it leaves out was cached already. They are keyed only while set, so caches made without them stay valid. #1437 adds the first two to the always-keyed list; either way works, and they would conflict in a few lines. A new test fails for any switch the translator's source reads that no list of the key names. Rebased onto `923e38c` it found the last three of the six by itself. **Shown by.** `the_builder_beside_bvh_miss_changes_the_shader_cache_key` (five settings, each in a process of its own), `switches_keyed_when_set_change_the_shader_cache_key`, `every_switch_of_the_translator_is_keyed_or_known_not_to_matter`. ## 3. A hang on the fallback paths of `present_planes` **What was wrong.** Where the two-plane composer cannot be made, or cannot record, `present_planes` shows the base plane alone by calling itself. It dropped `presenter` first, which is a reference into the guard of `Host::presenter`, not the guard. The guard lived on and the call locked the same mutex again, which waits for ever. Clippy names all three places (`drop` of a reference does nothing). **The change.** The guard is dropped. **Not run.** The path needs a composer that fails. It compiles and the crate's tests pass. ## 4. A free lets go of what is in place there `title_memory_freed` did not tell `crate::inplace`; only remaps did. The tables forget it now. This is half a fix: the heap itself goes when the last list and slot that hold it do, and until then the title's `VirtualFree` fails as it did. Nothing turns `VICTORY_INPLACE` on by default. No test of its own. ## 5. A bench of what the bus costs (`host/bus.rs`) An ignored test, no title files: ``` cargo test -p victory-gpu --release --lib host::bus -- --ignored --nocapture ``` Shaders read and store a 256 MiB buffer in each placement between two timestamps of the card. RTX 5080, Ryzen 9 9950X3D, two runs within 1 %: | Where the buffer lies | Shaders read | Shaders store | CPU copies in | CPU copies out | |---|---|---|---|---| | The PC's memory (`shared_buffer`, pool L0) | 32 GB/s | 2.0 GB/s | 31 GB/s | 10 GB/s | | The card's memory (`uav_buffer`) | 932 GB/s | 300 GB/s | | | | Card memory the CPU maps (`mapped_card_buffer`) | 940 GB/s | 301 GB/s | 32 GB/s | 0.09 GB/s | The figures for the card's memory are lower bounds. It would be useful to have the same from other cards, AMD above all. ## 6. `docs/unified-memory-audit.md` An audit of the tree at `32ecacf` against the five-track plan of Marvisak/VIctory issue 3703, with what other trees measured of the ways round the bridge, the waits that are left on the submitting thread, textures, the PC's memory, shaders and pipelines, and a road in phases. Its line numbers are of `32ecacf`; 205 commits have landed since, so check before relying on one. It makes no frame rate claim. ## 7. Small things - Clippy findings that `32ecacf` had: `shadow.rs`, `descriptor.rs`, `gameinput.rs`, and one in `victory-shader`'s tests. - Comments that said "off by default" for `VICTORY_RELAY`, `VICTORY_LATE_WAIT`, `VICTORY_WIDE_BACK` and `VICTORY_ASK_ONCE`, which are on; `tiles.rs` named a function that is called `card_writes`. ## Tested Windows 11 26300, RTX 5080 16 GB, driver 617.42, Rust 1.98.1, on `923e38c`. - `cargo test --workspace --locked`: every test passes but `xtask`'s `repository_passes_policy`, which fails on `main` the same way (`emit/lower.rs: 667523 bytes exceeds the 655360-byte limit`). `victory-gpu` 554 passed, 44 ignored; `victory-shader` 348 passed. - `cargo clippy --workspace --all-targets --locked -- -D warnings` does **not** pass, on `main` or here: two findings in `emit/lower.rs` and some dozen in `victory-gpu`, all from commits since `32ecacf`, none in a line this changes. ## Not verified - Nothing was run in the title. No frame rate, memory or picture claim is made for any of this. - Change 3 was not exercised; change 4 has no test. - The on-card run of `levels_on_demand_on_the_card` did not happen: it wants the D3D12 debug layer, which is not installed here. It passes on the software adapter. 🤖 Generated with [Claude Code]
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
trustno1-coder/VIctory-NVIDIA!1470
No description provided.