gpu: requeue remapped textures after their table grace period #3551

Open
ghptc wants to merge 1 commit from upstream-pr/3551 into main
ghptc commented 2026-11-30 00:51:54 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by ghptc on 2026-11-30T00:51:54Z.


A draw can read a placed texture through a descriptor table, then later read the same heap slot by shader index. If the backing pages change between these draws and the descriptor stays the same, dropping the slot from the remap selection can leave the indexed draw reading the old texels. The table-recency window is 240 frames. After #2607, an empty selection also advances the heap cursor, so that notification will not be reconsidered when recency expires.

Keep the remapped slot in the texture queue with the existing eight-frame table grace period. A subsequent table read can service it and remove the queued entry. Indexed reads can otherwise pick it up through the usual mapping checks, upload and publication path. This applies to exact overlaps and to the existing conservative rescan after history eviction. A rescan can therefore queue additional recently tabled slots.

I verified consumption using an independently generated Win64 D3D12 fixture on an RTX 5070 under Proton. Across 330 frames, 128 shader-indexed pixels identified each synthetic resource and generation. The dense case used 3,072 initially unavailable heap slots, actual page commits, and the production table-entry preparation path. Frame 80 read generation 1 through a table. Frame 81 replaced the backing at the same address. With the original compacting-history and cursor routines from #2607 on the common Linux test base, the indexed pixel still showed generation 1 at frame 330. The pre-#2607 Linux base first showed generation 2 at frame 322. With the fix on that base, it appeared at frame 89. The smaller test also verified frame 89 with the fix on top of both #2607 routines. Readback followed a fence on every frame.

The regression in the existing heap test exercises overflow of a private remap history, retention through the grace period and cancellation by a new table read. All 112 resources whose memory arrived became visible in the dense fixture. The 16 sampled unavailable controls kept their neutral color. Average dense fence cadence on the Linux base was 0.410 ms before and 0.413 ms after. This change addresses stale texture content. Credit to nidea1 for #2607.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5557037944 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3551). Originally posted by [ghptc](https://github.com/ghptc) on 2026-11-30T00:51:54Z. --- A draw can read a placed texture through a descriptor table, then later read the same heap slot by shader index. If the backing pages change between these draws and the descriptor stays the same, dropping the slot from the remap selection can leave the indexed draw reading the old texels. The table-recency window is 240 frames. After #2607, an empty selection also advances the heap cursor, so that notification will not be reconsidered when recency expires. Keep the remapped slot in the texture queue with the existing eight-frame table grace period. A subsequent table read can service it and remove the queued entry. Indexed reads can otherwise pick it up through the usual mapping checks, upload and publication path. This applies to exact overlaps and to the existing conservative rescan after history eviction. A rescan can therefore queue additional recently tabled slots. I verified consumption using an independently generated Win64 D3D12 fixture on an RTX 5070 under Proton. Across 330 frames, 128 shader-indexed pixels identified each synthetic resource and generation. The dense case used 3,072 initially unavailable heap slots, actual page commits, and the production table-entry preparation path. Frame 80 read generation 1 through a table. Frame 81 replaced the backing at the same address. With the original compacting-history and cursor routines from #2607 on the common Linux test base, the indexed pixel still showed generation 1 at frame 330. The pre-#2607 Linux base first showed generation 2 at frame 322. With the fix on that base, it appeared at frame 89. The smaller test also verified frame 89 with the fix on top of both #2607 routines. Readback followed a fence on every frame. The regression in the existing heap test exercises overflow of a private remap history, retention through the grace period and cancellation by a new table read. All 112 resources whose memory arrived became visible in the dense fixture. The 16 sampled unavailable controls kept their neutral color. Average dense fence cadence on the Linux base was 0.410 ms before and 0.413 ms after. This change addresses stale texture content. Credit to nidea1 for #2607.
Dukestar69 commented 2026-11-30 05:17:34 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Dukestar69 on 2026-11-30T05:17:34Z.

Review: APPROVED


Tested locally merged onto main (41adb551).

  • Merge: Clean merge in crates/victory-gpu/src/descriptor/host.rs.
  • Tests (RTX 5090): cargo test -p victory-gpu --lib descriptor::host::tests:: passed (72 passed; 0 failed; 1 ignored) with 0 new warnings.

Clean fix ensuring remapped textures are requeued after their table grace period. LGTM.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:review:6107196882 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3551#pullrequestreview-6107196882). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-30T05:17:34Z. **Review:** APPROVED --- Tested locally merged onto `main` (`41adb551`). - **Merge**: Clean merge in `crates/victory-gpu/src/descriptor/host.rs`. - **Tests (RTX 5090)**: `cargo test -p victory-gpu --lib descriptor::host::tests::` passed (`72 passed; 0 failed; 1 ignored`) with 0 new warnings. Clean fix ensuring remapped textures are requeued after their table grace period. LGTM. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
dyshay commented 2026-11-30 05:49:55 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by dyshay on 2026-11-30T05:49:55Z.


Merged into our fork's integration branch for testing (dyshay/VIctory-NVIDIA, branch janus-prs). I read the full diff first: no network access, process spawning, binaries, build or dependency changes, or game data. It builds with --profile diag --features diagnostics, and the CPU tests of the touched crates pass. A run on an RTX 4090 is queued (Series S with ray tracing, DLSS Quality). Frame times will follow here.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7270046680 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3551#issuecomment-7270046680). Originally posted by [dyshay](https://github.com/dyshay) on 2026-11-30T05:49:55Z. --- Merged into our fork's integration branch for testing ([dyshay/VIctory-NVIDIA](https://github.com/dyshay/VIctory-NVIDIA/tree/janus-prs), branch `janus-prs`). I read the full diff first: no network access, process spawning, binaries, build or dependency changes, or game data. It builds with `--profile diag --features diagnostics`, and the CPU tests of the touched crates pass. A run on an RTX 4090 is queued (Series S with ray tracing, DLSS Quality). Frame times will follow here.
nidea1 commented 2026-12-01 03:14:17 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nidea1 on 2026-12-01T03:14:17Z.


@ghptc Thanks for catching and cleanly fixing that #2607 empty-refresh cursor + 240-frame table-recency interaction — keeping the remapped slot queued with the 8-frame grace period handles shader-indexed reads cleanly.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7299491770 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3551#issuecomment-7299491770). Originally posted by [nidea1](https://github.com/nidea1) on 2026-12-01T03:14:17Z. --- @ghptc Thanks for catching and cleanly fixing that #2607 empty-refresh cursor + 240-frame table-recency interaction — keeping the remapped slot queued with the 8-frame grace period handles shader-indexed reads cleanly.
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/3551:upstream-pr/3551'
git switch 'upstream-pr/3551'

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/3551'
git switch 'upstream-pr/3551'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3551'
git switch 'upstream-pr/3551'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3551'
git switch 'main'
git merge --squash 'upstream-pr/3551'
git switch 'main'
git merge --ff-only 'upstream-pr/3551'
git switch 'main'
git merge 'upstream-pr/3551'
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
trustno1-coder/VIctory-NVIDIA!3551
No description provided.