Pin deferred texture flips to the uploaded descriptor #3840

Merged
Yoruiopz merged 1 commit from upstream-pr/3840 into main 2026-11-30 14:12:01 +00:00
Yoruiopz commented 2026-11-30 09:03:45 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Yoruiopz on 2026-11-30T09:03:45Z.


What it changes

A title descriptor can change while the renderer is scheduling the deferred publication of an upload. The upload was prepared from view A, but the deferred path could reread the handle after it changed to view B and associate A's completion with B. The existing completion guard would then be checking the wrong key.

Read the view and its key together. Carry that key through list and upload-worker callbacks, and check it under the slot lock before replacing a descriptor with the neutral view. The existing completion check now validates the key of the upload that actually ran.

How it was tested

  • Four focused victory-gpu descriptor tests passed on an RTX 5070 Laptop GPU with native D3D12, WARP disabled, and the locked diagnostics profile. The new asset-free fixture checks that stale completion cannot publish a replacement record, including when the host slot is still empty.
  • The staged asset policy and whitespace checks passed. Diagnostics Clippy completed with no warnings on the changed lines. Warning-as-error Clippy stops on the existing victory-shader warnings on main.
  • The native fixture validates the descriptor race. In-game visual impact remains unverified.

Checked for overlap

  • I searched for overlapping work. Credit to @mint17 and #720 for identifying the race and key-pinning approach. This isolates the deferred flip guard and its regression test on current main so it can be reviewed independently of the opt-in heap worker. List scheduling and worker configuration are unchanged.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5562197668 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3840). Originally posted by [Yoruiopz](https://github.com/Yoruiopz) on 2026-11-30T09:03:45Z. --- ## What it changes A title descriptor can change while the renderer is scheduling the deferred publication of an upload. The upload was prepared from view A, but the deferred path could reread the handle after it changed to view B and associate A's completion with B. The existing completion guard would then be checking the wrong key. Read the view and its key together. Carry that key through list and upload-worker callbacks, and check it under the slot lock before replacing a descriptor with the neutral view. The existing completion check now validates the key of the upload that actually ran. ## How it was tested - Four focused victory-gpu descriptor tests passed on an RTX 5070 Laptop GPU with native D3D12, WARP disabled, and the locked diagnostics profile. The new asset-free fixture checks that stale completion cannot publish a replacement record, including when the host slot is still empty. - The staged asset policy and whitespace checks passed. Diagnostics Clippy completed with no warnings on the changed lines. Warning-as-error Clippy stops on the existing victory-shader warnings on main. - The native fixture validates the descriptor race. In-game visual impact remains unverified. ## Checked for overlap - [x] I searched for overlapping work. Credit to @mint17 and #720 for identifying the race and key-pinning approach. This isolates the deferred flip guard and its regression test on current main so it can be reviewed independently of the opt-in heap worker. List scheduling and worker configuration are unchanged.
tyr0nsur commented 2026-11-30 09:56:19 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by tyr0nsur on 2026-11-30T09:56:19Z.


The immediate publication paths can still reread a replacement descriptor. In 3d65cbe, both at_once (no upload needed) and the shows_other branch for unchanged contents can check view A, then call ordinary mirror after the slot has been rewritten to view B. The deferred key check cannot cover those calls.

Follow-up 6855892 uses the key the texture pass already has and checks it under the existing mirror lock before any slot bookkeeping. It keeps the normal mirror and show_new_later rules. An empty snapshot can still clear a slot that stays empty, while a new valid view waits for its own turn.

I extended the existing asset-free D3D12 fixture. The stale immediate attempt returned B before the change and is rejected after it. The current-key and still-empty cases also pass. The targeted descriptor and draw diagnostics suite passed on RTX 4060 (90 passed, 1 ignored). All four focused tests passed with WARP and staged asset policy passed. Gameplay impact remains unmeasured.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7274889702 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3840#issuecomment-7274889702). Originally posted by [tyr0nsur](https://github.com/tyr0nsur) on 2026-11-30T09:56:19Z. --- The immediate publication paths can still reread a replacement descriptor. In `3d65cbe`, both `at_once` (no upload needed) and the `shows_other` branch for unchanged contents can check view A, then call ordinary `mirror` after the slot has been rewritten to view B. The deferred key check cannot cover those calls. [Follow-up 6855892](https://github.com/tyr0nsur/VIctory-NVIDIA/commit/68558929ef592dee6bba78705cda5432ebfa44ad) uses the key the texture pass already has and checks it under the existing mirror lock before any slot bookkeeping. It keeps the normal mirror and `show_new_later` rules. An empty snapshot can still clear a slot that stays empty, while a new valid view waits for its own turn. I extended the existing asset-free D3D12 fixture. The stale immediate attempt returned B before the change and is rejected after it. The current-key and still-empty cases also pass. The targeted descriptor and draw diagnostics suite passed on RTX 4060 (90 passed, 1 ignored). All four focused tests passed with WARP and staged asset policy passed. Gameplay impact remains unmeasured.
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!3840
No description provided.