native: VICTORY_TEXTURE_DROP_TOP_MIP=2 also drops a second level of very large textures #473

Manually merged
github merged 1 commit from github-bot/gh-469 into main 2026-11-28 00:42:34 +00:00 AGit
Owner

@⁠Hayyan612 on GitHub · 2026-11-27 21:35 UTC · original
Hayyan612:gpu/top-mip-drop-2 → main · +86 −26 · 4 files · 1 commits · merged 2026-11-28 00:38 UTC

What this changes

Follow-up to the top-mip drop (#350, merged): VICTORY_TEXTURE_DROP_TOP_MIP=2 also makes a sampled-only 2D texture whose larger side is at least 4096 texels, and that has two levels below its top, without its top two levels: a quarter of the width and height, about 94% of its memory. Textures from 1024 to 4095 still lose one level, a texture always keeps at least one, and =1 is unchanged. Off by default, like =1.

The upload, the background job, the view mapping (host_mip_range) and the copies (host_mip in 80a012f1, mip - dropped_levels()) already take any number of dropped levels; the selection now takes the setting's level instead of a flag. Docs: docs/native-host.md and docs/metal-backend.md.

Refs #349

How it was tested

  • cargo test --target x86_64-apple-darwin -p victory-hle -p victory-loader -p victory: not run; the change is in victory-gpu only. Ran natively on arm64 instead: cargo test -p victory-gpu --lib -- drop_top_mip a_texture_made_without host_mip_range texture, 85 passed, 2 ignored. New tests: setting_two_drops_a_second_level_only_from_very_large_textures, host_mip_range with two levels dropped, and a_texture_made_without_two_levels_gets_the_levels_below (Metal: the host texture's level 0 receives the title's level 2).
  • cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings (on main b998bb65 with this commit)
  • Ran the game: not done here. Measuring it as Sandile-0511 and ItsMariusBC did for =1 (heap_set_mb, failed command buffers, lowest memory level) would show what the second level adds and what it costs in sharpness up close.

Checklist

  • No game files, game code, disassembly listings or SDK files are included
  • Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md (none: this is a host-side memory shortcut, documented as such)
  • New diagnostics are behind a VICTORY_* variable and documented (no new variable; VICTORY_TEXTURE_DROP_TOP_MIP gains the value 2)
**@⁠Hayyan612** on GitHub · 2026-11-27 21:35 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/469) `Hayyan612:gpu/top-mip-drop-2` → `main` · +86 −26 · 4 files · 1 commits · merged 2026-11-28 00:38 UTC ## What this changes Follow-up to the top-mip drop (#350, merged): `VICTORY_TEXTURE_DROP_TOP_MIP=2` also makes a sampled-only 2D texture whose larger side is at least 4096 texels, and that has two levels below its top, without its top two levels: a quarter of the width and height, about 94% of its memory. Textures from 1024 to 4095 still lose one level, a texture always keeps at least one, and `=1` is unchanged. Off by default, like `=1`. The upload, the background job, the view mapping (`host_mip_range`) and the copies (`host_mip` in 80a012f1, `mip - dropped_levels()`) already take any number of dropped levels; the selection now takes the setting's level instead of a flag. Docs: `docs/native-host.md` and `docs/metal-backend.md`. Refs #349 ## How it was tested - [ ] `cargo test --target x86_64-apple-darwin -p victory-hle -p victory-loader -p victory`: not run; the change is in `victory-gpu` only. Ran natively on arm64 instead: `cargo test -p victory-gpu --lib -- drop_top_mip a_texture_made_without host_mip_range texture`, 85 passed, 2 ignored. New tests: `setting_two_drops_a_second_level_only_from_very_large_textures`, `host_mip_range` with two levels dropped, and `a_texture_made_without_two_levels_gets_the_levels_below` (Metal: the host texture's level 0 receives the title's level 2). - [x] `cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings` (on main `b998bb65` with this commit) - [ ] Ran the game: not done here. Measuring it as Sandile-0511 and ItsMariusBC did for `=1` (`heap_set_mb`, failed command buffers, lowest memory level) would show what the second level adds and what it costs in sharpness up close. ## Checklist - [x] No game files, game code, disassembly listings or SDK files are included - [x] Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md (none: this is a host-side memory shortcut, documented as such) - [x] New diagnostics are behind a `VICTORY_*` variable and documented (no new variable; `VICTORY_TEXTURE_DROP_TOP_MIP` gains the value 2)
Follow-up to the top-mip drop (#347): with the setting at 2, a sampled-only
2D texture whose larger side is at least 4096 texels and that has two levels
below its top is made without both (a quarter of the width and height,
about 94% of its memory); textures from 1024 still lose one. A texture
always keeps at least one level. The setting 1 is unchanged.

Upload, the background job and the view mapping already take any count;
the selection takes the level setting instead of a flag.

Tests: setting_two_drops_a_second_level_only_from_very_large_textures,
host_mip_range with two dropped, and
a_texture_made_without_two_levels_gets_the_levels_below (Metal).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 21:37:56 +00:00
github manually merged commit 08b2337381 into main 2026-11-28 00:42:34 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.