GPU/descriptor: refresh tiled texture slots for tabled views and stale first_shown #764

Open
github-bot wants to merge 1 commit from github-bot/gh-764 into main AGit
Owner

@⁠AscilCH on GitHub · 2026-11-25 06:44 UTC · original
AscilCH:fix/gpu-descriptor-tabled-tiled-slots-remake → main · +289 −20 · 1 files · 1 commits · open

Problem

Under levels-on-demand (VICTORY_LEVELS_ON_DEMAND=1), make() shifts a tiled texture's host SRV to start at first_shown(), and OnDemand::uploaded()/card_wrote() records the texture's start address in RESHOWN for HostHeap::texture_views_remade(). Two gaps left tabled (and non-placed) tiled texture slots permanently stuck at unmapped MostDetailedMip = 0 (black) or stale mips:

  1. HostHeap::note_buffer() excludes tabled_lately slots from self.placed (Spans), so HostHeap::texture_views_remade() never found tabled slots when draining RESHOWN.
  2. HostHeap::mirror() only rebuilt a slot when made[index] != key. Once a draw mirrored a tabled tiled slot before its first upload (first_shown() == None -> MostDetailedMip = 0) or before finer mips arrived, every subsequent draw hit made[index] == key and skipped make().

Fix

  • Track slots backed by a tiled texture in HostHeap::tiled_shown (TiledSlots), storing the OnDemand handle, optional placed start address (including tabled slots excluded from self.placed), and the first_shown level baked into the slot, gated by a fast has_tiled: AtomicBool so non-tiled heaps incur no mutex overhead.
  • Include tiled_shown.slots_at(start) in HostHeap::texture_views_remade().
  • In HostHeap::mirror(), when made[index] == key and tiled_stale(index) is true (first_shown() changed since the slot was built), rebuild the host descriptor and update tiled_shown.

Verification

  • cargo test -p victory-gpu --locked -- descriptor::host::tests: 20 passed; 0 failed (including pure unit test tiled_slots_tracks_tabled_starts_and_detects_first_shown_changes).
  • VICTORY_LEVELS_ON_DEMAND=1 cargo test -p victory-gpu --locked -- descriptor::host::tests::tabled_tiled_slot_remakes_when_first_shown_changes: 1 passed; 0 failed (exercising a real tiled placed texture on D3D12 hardware through both texture_views_remade() and mirror()).
  • cargo clippy -p victory-gpu --all-targets --all-features --locked: 0 warnings in descriptor/host.rs (only pre-existing 8dd30ab warnings in draw.rs:2377 and indirect.rs:1322).
  • cargo xtask policy: 171 files ok.

(AI-assisted; synthetic unit tests only, no game data.)

**@⁠AscilCH** on GitHub · 2026-11-25 06:44 UTC · [original](https://github.com/fxceless/victory-fork/pull/764) `AscilCH:fix/gpu-descriptor-tabled-tiled-slots-remake` → `main` · +289 −20 · 1 files · 1 commits · open ### Problem Under levels-on-demand (`VICTORY_LEVELS_ON_DEMAND=1`), `make()` shifts a tiled texture's host SRV to start at `first_shown()`, and `OnDemand::uploaded()`/`card_wrote()` records the texture's start address in `RESHOWN` for `HostHeap::texture_views_remade()`. Two gaps left tabled (and non-placed) tiled texture slots permanently stuck at unmapped `MostDetailedMip = 0` (black) or stale mips: 1. `HostHeap::note_buffer()` excludes `tabled_lately` slots from `self.placed` (`Spans`), so `HostHeap::texture_views_remade()` never found tabled slots when draining `RESHOWN`. 2. `HostHeap::mirror()` only rebuilt a slot when `made[index] != key`. Once a draw mirrored a tabled tiled slot before its first upload (`first_shown() == None` -> `MostDetailedMip = 0`) or before finer mips arrived, every subsequent draw hit `made[index] == key` and skipped `make()`. ### Fix - Track slots backed by a tiled texture in `HostHeap::tiled_shown` (`TiledSlots`), storing the `OnDemand` handle, optional placed start address (including tabled slots excluded from `self.placed`), and the `first_shown` level baked into the slot, gated by a fast `has_tiled: AtomicBool` so non-tiled heaps incur no mutex overhead. - Include `tiled_shown.slots_at(start)` in `HostHeap::texture_views_remade()`. - In `HostHeap::mirror()`, when `made[index] == key` and `tiled_stale(index)` is true (`first_shown()` changed since the slot was built), rebuild the host descriptor and update `tiled_shown`. ### Verification - `cargo test -p victory-gpu --locked -- descriptor::host::tests`: `20 passed; 0 failed` (including pure unit test `tiled_slots_tracks_tabled_starts_and_detects_first_shown_changes`). - `VICTORY_LEVELS_ON_DEMAND=1 cargo test -p victory-gpu --locked -- descriptor::host::tests::tabled_tiled_slot_remakes_when_first_shown_changes`: `1 passed; 0 failed` (exercising a real tiled placed texture on D3D12 hardware through both `texture_views_remade()` and `mirror()`). - `cargo clippy -p victory-gpu --all-targets --all-features --locked`: 0 warnings in `descriptor/host.rs` (only pre-existing `8dd30ab` warnings in `draw.rs:2377` and `indirect.rs:1322`). - `cargo xtask policy`: `171 files ok`. *(AI-assisted; synthetic unit tests only, no game data.)*
Levels-on-demand (`tiles.rs`) shifts a tiled texture's host SRV to start at
`first_shown()` once tiles are mapped, and queues the texture's start address
in `RESHOWN` for `HostHeap::texture_views_remade()`. Two gaps left tabled (and
non-placed) tiled texture slots permanently stuck on unmapped `MostDetailedMip
= 0` (solid black) or stale mip levels:

1. `HostHeap::note_buffer()` excludes `tabled_lately` slots from `self.placed`
   (`Spans`), so `HostHeap::texture_views_remade()` never found tabled slots
   when draining `RESHOWN`.
2. `HostHeap::mirror()` checked only `made[index] != key`, so once a tiled
   slot was built before its first upload (`first_shown() == None` ->
   `MostDetailedMip = 0`) or before finer mips arrived, subsequent draws
   calling `mirror()` hit `made[index] == key` and never rebuilt the SRV.

Track made tiled slots in `HostHeap::tiled_shown` (recording the `OnDemand`
handle, optional placed start address, and the `first_shown` level baked into
the slot). Include `tiled_shown.slots_at(start)` in `texture_views_remade()`,
and rebuild the slot in `mirror()` whenever its `first_shown()` has changed
since the slot was last built.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:50:34 +00:00
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/descriptor/host.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/764/head:github-bot/gh-764'
git switch 'github-bot/gh-764'

Merge

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