gpu: VICTORY_TEXTURE_DROP_MIPS leaves out the largest levels of big title textures #1950

Open
github-bot wants to merge 3 commits from github-bot/gh-1950 into main AGit
Owner

@⁠bekandev on GitHub · 2026-11-29 04:01 UTC · original
bekandev:feat/texture-drop-mips → main · +505 −24 · 5 files · 3 commits · open

[pr-feature] gpu: VICTORY_TEXTURE_DROP_MIPS leaves out the largest levels of big title textures

What it changes

On an 8 GB card the textures picked by index stop at the memory budget with thousands more due, and the world shows bare geometry. VICTORY_TEXTURE_DROP_MIPS=N (0, off by default; at most 4) makes the host copy of a 2D texture the title fills (arrays and cubes included, at least 512 texels on its shorter side, whole 4-texel blocks after halving) begin N levels down, about a quarter of the bytes per level left out. Views shift their levels, copies between such a texture and another go level by level or are skipped, read-backs map to the title's levels, and the copies-between step keeps its arithmetic at N=0.

Ported from soldsawn/victory-nvidia-8gb (originally fxceless/victory-fork#610), adapted to this tree's held-level machinery (copy.base, Staging.first), credited in the code and the README. Off by default: with N=0 every new branch is an identity.

How it was tested

  • GPU and profile: GeForce RTX 5060 8 GB, Ryzen 7 5700X, 16 GB RAM, Series S profile, DLSS performance, frame generation off, 30 fps cap, Windows 11. Diagnostics build of main 8fc2254 + this change + #76.
  • Before: world entry at 2-3.5 fps, most surfaces bare geometry (gray/black); about 16,700 textures uploaded (6.6 GB), no room for the rest of the run.
  • After (VICTORY_TEXTURE_DROP_MIPS=1, after PRELOAD SHADERS): textures visible; 9.1-9.6 fps in the same place; 42,187 textures uploaded (3.4 GB) by world entry with the card inside its budget; in one run 71,575 textures (8.7 GB) over a longer session. Loading at 30 fps with no no room.
  • For shader changes: none (resource/list/descriptor paths only).
  • cargo test passed for the crates it touches: yes. Five pure tests in crates/victory-gpu/src/resource.rs (eligibility rules, the subresource and read-back maps, the view shift against the old from_base arithmetic over 1,008 shapes, views shifting down). On GitHub windows-latest (my fork): cargo build --workspace --locked --all-targets ok; the only failing test is emit::wave64_tests::nv05d1_native_readlane_gpu_reference, which also fails and passes at random on main (568c5e5) with the same workflow, in a crate this does not touch.

Known limits, checked by an independent review of the port: a view of a 2D array held-level texture now shifts like the 2D one did (a correction: before it could name mips the host copy does not have); a droppable placed-view texture that aliases a host-written one loses the alias copy and falls back to the title-memory fill; a copy from a dropped texture into a non-dropped one leaves the dropped levels unwritten (inherent to the size change).

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #609 (the render-target reserve on 8 GB cards; #76, which this was tested beside), #610's origin in fxceless/victory-fork.
**@⁠bekandev** on GitHub · 2026-11-29 04:01 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1950) `bekandev:feat/texture-drop-mips` → `main` · +505 −24 · 5 files · 3 commits · open [pr-feature] gpu: VICTORY_TEXTURE_DROP_MIPS leaves out the largest levels of big title textures ## What it changes On an 8 GB card the textures picked by index stop at the memory budget with thousands more due, and the world shows bare geometry. `VICTORY_TEXTURE_DROP_MIPS=N` (0, off by default; at most 4) makes the host copy of a 2D texture the title fills (arrays and cubes included, at least 512 texels on its shorter side, whole 4-texel blocks after halving) begin N levels down, about a quarter of the bytes per level left out. Views shift their levels, copies between such a texture and another go level by level or are skipped, read-backs map to the title's levels, and the copies-between step keeps its arithmetic at N=0. Ported from [soldsawn/victory-nvidia-8gb](https://github.com/soldsawn/victory-nvidia-8gb) (originally [fxceless/victory-fork#610](https://github.com/fxceless/victory-fork/issues/610)), adapted to this tree's held-level machinery (`copy.base`, `Staging.first`), credited in the code and the README. Off by default: with N=0 every new branch is an identity. ## How it was tested - GPU and profile: GeForce RTX 5060 8 GB, Ryzen 7 5700X, 16 GB RAM, Series S profile, DLSS performance, frame generation off, 30 fps cap, Windows 11. Diagnostics build of main 8fc2254 + this change + #76. - Before: world entry at 2-3.5 fps, most surfaces bare geometry (gray/black); about 16,700 textures uploaded (6.6 GB), `no room` for the rest of the run. - After (VICTORY_TEXTURE_DROP_MIPS=1, after PRELOAD SHADERS): textures visible; 9.1-9.6 fps in the same place; 42,187 textures uploaded (3.4 GB) by world entry with the card inside its budget; in one run 71,575 textures (8.7 GB) over a longer session. Loading at 30 fps with no `no room`. - For shader changes: none (resource/list/descriptor paths only). - `cargo test` passed for the crates it touches: yes. Five pure tests in `crates/victory-gpu/src/resource.rs` (eligibility rules, the subresource and read-back maps, the view shift against the old `from_base` arithmetic over 1,008 shapes, views shifting down). On GitHub `windows-latest` (my fork): `cargo build --workspace --locked --all-targets` ok; the only failing test is `emit::wave64_tests::nv05d1_native_readlane_gpu_reference`, which also fails and passes at random on main (568c5e5) with the same workflow, in a crate this does not touch. Known limits, checked by an independent review of the port: a view of a 2D array held-level texture now shifts like the 2D one did (a correction: before it could name mips the host copy does not have); a droppable placed-view texture that aliases a host-written one loses the alias copy and falls back to the title-memory fill; a copy from a dropped texture into a non-dropped one leaves the dropped levels unwritten (inherent to the size change). ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #609 (the render-target reserve on 8 GB cards; #76, which this was tested beside), #610's origin in fxceless/victory-fork.
On 8 GB cards the textures picked by index stop at the memory budget with
thousands more due. VICTORY_TEXTURE_DROP_MIPS=N (0 off, the default; at most
4) makes the host copy of a 2D texture the title fills (arrays and cubes
too, at least 512 texels on its shorter side, whole 4-texel blocks after
halving) begin N levels down: about a quarter of the bytes per level. Views
shift their levels, copies between such a texture and another go level by
level or are skipped, and read-backs map to the title's levels.

Ported from soldsawn/victory-nvidia-8gb (originally fxceless/victory-fork#610).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 04:05:38 +00:00
Author
Owner

@⁠CuteBooty on GitHub · 2026-11-29 20:57 UTC · original

A review of this PR's diff (head 098fb6ba0), plus a port of it that we read in full. The findings below come from reading the source. No game run was made with VICTORY_TEXTURE_DROP_MIPS set, and the PR's own tests are index-arithmetic tests, so none of this is measured. With the switch at 0 the new branches looked like identities to us.

The common thread: when a GPU write lands in a texture whose host copy has its largest levels left out, or a texture is read through a path that needs those levels, the data can be lost, and the surface shows black or stale texels. fills limits the reduction to textures the title fills, but a GPU-written texture can still reach one through a copy, a resolve, a readback, or an alias in another format.

  1. Whole-texture copy from a reduced texture into a full one (copy_resource / copy_levels in list.rs). copy_levels copies only the levels both host copies have. The destination's level 0 is not written, but as far as we read, the destination is still treated as written by the copy. A later read of level 0 sees old or uninitialized contents.
  2. Resolve with a reduced endpoint (resolve in list.rs). The operation is skipped when either side is reduced. A 512x512 multisampled source resolving into level 1 of a 1024x1024 destination (host level 0 when one level is dropped) is a valid write that is lost.
  3. Readback of an omitted level (read_back). The destination buffer is left untouched, so a title that reads back a level the host copy does not have gets whatever the buffer held.
  4. A shader view and a writable view over the same memory in another format (alias in texture.rs). The alias is declined when the drop counts differ, and the fallback uploads from title memory, where the latest GPU writes do not exist. Even the retained levels can read black or stale.

In our port we closed the first three by copying from the source box at the source's pitch, resolving into the host level numbering, and preparing every needed source level before the copy writes. For case 4 we retired the reduced copy when a writer over the same memory appears. Those fixes are also unrun. Two limits remain in our port: a write that targets an omitted destination level is still skipped, and retiring a reduced copy does not bring across GPU-only writes it already took.

On the test hardware we use, an RTX 3070 8 GB with a Ryzen 7 5800X3D, 32 GB, Windows 11 26200, driver 621.24, we have not tried this PR in play. We rated it "do not try" for GPU-written textures, on these reading-only grounds. We would be glad to hear if the author has seen these cases in a run.

**@⁠CuteBooty** on GitHub · 2026-11-29 20:57 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1950#issuecomment-7262488940) A review of this PR's diff (head `098fb6ba0`), plus a port of it that we read in full. The findings below come from reading the source. No game run was made with `VICTORY_TEXTURE_DROP_MIPS` set, and the PR's own tests are index-arithmetic tests, so none of this is measured. With the switch at 0 the new branches looked like identities to us. The common thread: when a GPU write lands in a texture whose host copy has its largest levels left out, or a texture is read through a path that needs those levels, the data can be lost, and the surface shows black or stale texels. `fills` limits the reduction to textures the title fills, but a GPU-written texture can still reach one through a copy, a resolve, a readback, or an alias in another format. 1. **Whole-texture copy from a reduced texture into a full one** (`copy_resource` / `copy_levels` in `list.rs`). `copy_levels` copies only the levels both host copies have. The destination's level 0 is not written, but as far as we read, the destination is still treated as written by the copy. A later read of level 0 sees old or uninitialized contents. 2. **Resolve with a reduced endpoint** (`resolve` in `list.rs`). The operation is skipped when either side is reduced. A 512x512 multisampled source resolving into level 1 of a 1024x1024 destination (host level 0 when one level is dropped) is a valid write that is lost. 3. **Readback of an omitted level** (`read_back`). The destination buffer is left untouched, so a title that reads back a level the host copy does not have gets whatever the buffer held. 4. **A shader view and a writable view over the same memory in another format** (`alias` in `texture.rs`). The alias is declined when the drop counts differ, and the fallback uploads from title memory, where the latest GPU writes do not exist. Even the retained levels can read black or stale. In our port we closed the first three by copying from the source box at the source's pitch, resolving into the host level numbering, and preparing every needed source level before the copy writes. For case 4 we retired the reduced copy when a writer over the same memory appears. Those fixes are also unrun. Two limits remain in our port: a write that targets an omitted destination level is still skipped, and retiring a reduced copy does not bring across GPU-only writes it already took. On the test hardware we use, an RTX 3070 8 GB with a Ryzen 7 5800X3D, 32 GB, Windows 11 26200, driver 621.24, we have not tried this PR in play. We rated it "do not try" for GPU-written textures, on these reading-only grounds. We would be glad to hear if the author has seen these cases in a run.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/descriptor/host.rs
  • crates/victory-gpu/src/list.rs
  • crates/victory-gpu/src/resource.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1950'
git switch 'github-bot/gh-1950'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1950'
git switch 'github-bot/gh-1950'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1950'
git switch 'main'
git merge --squash 'github-bot/gh-1950'
git switch 'main'
git merge --ff-only 'github-bot/gh-1950'
git switch 'main'
git merge 'github-bot/gh-1950'
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/trustno1-coder--VIctory-NVIDIA!1950
No description provided.