fix(gpu): defer view-first alias descriptor rewrite until copy finishes #623

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

@⁠chefulano on GitHub · 2026-12-05 20:22 UTC · original
chefulano:fix/alias-deferred-refresh → main · +126 −12 · 3 files · 1 commits · open

In #550, when a placed alias view is created before its first texture::alias() copy (view-first order), copy_target() detaches the pooled copy onto REPLACED and immediately queues a descriptor slot rewrite for the next make_waiting(). That lets shaders sample the freshly allocated, uncopied target for up to one frame before the alias copy submission completes (flagged in #550 review by @⁠Kal0s-design and @⁠t-jonesy).

This small follow-up defers the view-first descriptor rewrite until the alias copy submission finishes, mirroring RESHOWN_AFTER in descriptor/host.rs (REPLACED already keeps the retired copy alive until then):

  • Extends REPLACED_TEXTURES with an after_submission: u64 gate (queue_texture_replaced_after / take_replaced_textures_ready(finished)), keeping after == 0 immediate for existing callers while make_waiting() drains ready entries against host::submissions().1.
  • Adds copy_target_for_alias_deferred() and a PendingAliasRefresh RAII guard in texture::alias() so both copy paths defer queue_texture_replaced_after(placed, start, true, host::submissions().0) via list.defer_host(...), while any early return before recording the copy falls back to immediate refresh on drop so the detached copy is never stranded.
  • Adds descriptor::tests::queued_texture_replacements_defer_until_submission_finishes.

Verification on main (a5c6484):

  • cargo xtask policy: 368 files ok; policy::tests: 7 passed, 0 failed; switches::documented_switches_are_read: 1 passed, 0 failed.
  • cargo check --locked --target x86_64-pc-windows-msvc -p victory-gpu -p victory --tests and cargo clippy --no-deps --locked --target x86_64-pc-windows-msvc -p victory-gpu -p victory --all-targets: 0 errors, 0 new warnings.
  • Scoped Windows unit tests: descriptor::tests::queued_texture_replacements (2 passed, 0 failed).

Created with Gemini 4 Neon in T3 Code.

**@⁠chefulano** on GitHub · 2026-12-05 20:22 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/623) `chefulano:fix/alias-deferred-refresh` → `main` · +126 −12 · 3 files · 1 commits · open In #550, when a placed alias view is created before its first `texture::alias()` copy (view-first order), `copy_target()` detaches the pooled copy onto `REPLACED` and immediately queues a descriptor slot rewrite for the next `make_waiting()`. That lets shaders sample the freshly allocated, uncopied target for up to one frame before the alias copy submission completes (flagged in #550 review by @⁠Kal0s-design and @⁠t-jonesy). This small follow-up defers the view-first descriptor rewrite until the alias copy submission finishes, mirroring `RESHOWN_AFTER` in `descriptor/host.rs` (`REPLACED` already keeps the retired copy alive until then): - Extends `REPLACED_TEXTURES` with an `after_submission: u64` gate (`queue_texture_replaced_after` / `take_replaced_textures_ready(finished)`), keeping `after == 0` immediate for existing callers while `make_waiting()` drains ready entries against `host::submissions().1`. - Adds `copy_target_for_alias_deferred()` and a `PendingAliasRefresh` RAII guard in `texture::alias()` so both copy paths defer `queue_texture_replaced_after(placed, start, true, host::submissions().0)` via `list.defer_host(...)`, while any early return before recording the copy falls back to immediate refresh on drop so the detached copy is never stranded. - Adds `descriptor::tests::queued_texture_replacements_defer_until_submission_finishes`. Verification on `main` (`a5c6484`): - `cargo xtask policy`: `368 files ok`; `policy::tests`: `7 passed, 0 failed`; `switches::documented_switches_are_read`: `1 passed, 0 failed`. - `cargo check --locked --target x86_64-pc-windows-msvc -p victory-gpu -p victory --tests` and `cargo clippy --no-deps --locked --target x86_64-pc-windows-msvc -p victory-gpu -p victory --all-targets`: 0 errors, 0 new warnings. - Scoped Windows unit tests: `descriptor::tests::queued_texture_replacements` (`2 passed, 0 failed`). Created with Gemini 4 Neon in T3 Code.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 20:23:55 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

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