Return dynamic descriptor slots to their original heap #53

Manually merged
github merged 2 commits from github-bot/gh-53 into main 2026-11-26 19:54:24 +00:00 AGit
Owner

@⁠TaynanGT on GitHub · 2026-11-26 19:37 UTC · original
TaynanGT:fix/descriptor-heap-identity → main · +51 −24 · 4 files · 2 commits · merged 2026-11-26 19:50 UTC

Port fxceless/victory-fork#1324, preserving the original authorship. If a title heap is destroyed and its address reused, releasing an old list's dynamic slots must leave the replacement heap's allocations alone. Each range now carries the host heap identity, and a release with a stale identity leaves the range untouched.

All three allocation paths record the identity, and both list cleanup paths check it. The regression uses two heaps and checks that a stale release leaves the new range allocated. The current free-run search and duplicate-release handling are preserved. Syntax and diff checks passed. Windows CI is pending.

**@⁠TaynanGT** on GitHub · 2026-11-26 19:37 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/53) `TaynanGT:fix/descriptor-heap-identity` → `main` · +51 −24 · 4 files · 2 commits · merged 2026-11-26 19:50 UTC Port [fxceless/victory-fork#1324](https://github.com/fxceless/victory-fork/pull/1324), preserving the original authorship. If a title heap is destroyed and its address reused, releasing an old list's dynamic slots must leave the replacement heap's allocations alone. Each range now carries the host heap identity, and a release with a stale identity leaves the range untouched. All three allocation paths record the identity, and both list cleanup paths check it. The regression uses two heaps and checks that a stale release leaves the new range allocated. The current free-run search and duplicate-release handling are preserved. Syntax and diff checks passed. Windows CI is pending.
`State::dynamic` keeps the title heap of each range of dynamic descriptor
slots by its address, and `descriptor::release_dynamic` frees the range in
whatever host heap is registered at that address when the list is reset. A
list may outlive the title heap it recorded slots from: D3D12 keeps an
object alive while a command list names it, so the title can release a
shader-visible heap before the lists that use it are reset. If a later heap
is made at the same address (a `Box<Heap>` of the same size), the old
list's reset then frees slots of the new heap that other lists hold - two
live lists get the same dynamic slots, and one rewrites the other's
descriptors.

Give each host heap an identity (`NEXT_ID`) and record it with the range;
`release` frees only when the identity is the heap's. A stale release now
does nothing (the host heap it named is gone, so its slots are too); a heap
still there takes its own ranges back as before.

Test: `dynamic_slots_are_given_back_only_to_the_heap_that_took_them` (two
host heaps; A's range released with B's identity frees nothing, with A's
frees it). It needs a host device: with `VICTORY_D3D12_WARP=1` and
`--features diagnostics` locally it passes with the change and fails
without it (free slots 262,144 against 262,142); CI runs the gpu tests on
WARP. `cargo test -p victory-gpu --lib`: 218 passed, 0 failed, 6 ignored;
`cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean, and the
same with `--all-features`.

Reachability in the title is not proven - the game cannot be run here - so
this hardens a D3D12 lifetime the layer already relies on.

(cherry picked from commit 26090858ea21dbe40650ab011fd4fb4db4d731fc)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 19:44:43 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-26 19:37 UTC · original · edited 2026-11-26 19:39 UTC

Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-26T19:37:57.829552Z 3fe4811 PR opened
🔒 Security Review ✅ Completed 2026-11-26T19:39:32.705048Z 3fe4811 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-26 19:37 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/53#issuecomment-7201788440) · edited 2026-11-26 19:39 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"3fe48113d16b06b3c641780fed7f0f1fc67a7fe7","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":"3fe48113d16b06b3c641780fed7f0f1fc67a7fe7","has_any_findings":null,"has_unresolved_findings":null,"status":"completed"}} --> <!-- codex-security-review:v1 {"blockingSeverityThreshold":"P0","headSha":"3fe48113d16b06b3c641780fed7f0f1fc67a7fe7","mergeGateEnabled":false,"pullRequestNumber":53,"repository":"TaynanGT/Vice-Tay","status":"completed"} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-26T19:37:57.829552Z">2026-11-26T19:37:57.829552Z</relative-time> | `3fe4811` | PR opened | | 🔒 **Security Review** | ✅ **Completed** <relative-time datetime="2026-11-26T19:39:32.705048Z">2026-11-26T19:39:32.705048Z</relative-time> | `3fe4811` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
github manually merged commit 0b5b906f88 into main 2026-11-26 19:54:24 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.