Fix descriptor heap lifetime and batch card-step heap upgrades #48

Merged
nativ69 merged 3 commits from upstream-pr/48 into dev 2026-12-01 17:46:10 +00:00
nativ69 commented 2026-11-30 01:18:18 +00:00 (Migrated from github.com)

Imported from edsuuu/VI-BR-PORT. Originally posted by nativ69 on 2026-11-30T01:18:18Z.


Problem

HeapRanges was stored in a global cache keyed by the host heap's address. Destroying a descriptor heap did not remove its cached ranges, potentially retaining stale Shadow references and allowing a replacement heap at the same address to inherit stale range state.

Changes

  • Tie range state and refresh tracking to the owning HostHeap.
  • Retain host heaps through recorded and in-flight command lists.
  • Validate heap identity in deferred callbacks to prevent stale updates after address reuse.
  • Enforce heap retention when recording deferred slot fills.
  • Gracefully skip expired heap references instead of panicking.
  • Batch Weak::upgrade operations across consecutive slot fills targeting the same heap, reducing atomic reference-count contention while preserving execution order.
  • Add bounded, opt-in lifetime diagnostics (VICTORY_HEAP_LIFETIME=1).

Validation

  • All 16 heap lifetime tests passed on a real GPU.
  • Added regression coverage for address reuse, resource retention, heap cleanup, expired slot fills, and concurrent upgrade batching.
  • Workspace tests, Clippy (with and without all features), and documentation checks passed across the commits.
  • Three focused gameplay smoke tests, lasting approximately 2–3 minutes each including startup, completed without crashes or ERROR-level log entries.

Tested on Windows 11, Ryzen 7 5800X, RTX 4070 (12 GB), and 32 GB DDR4-3200, using the Xbox Series S configuration.

The gameplay tests were limited to the opening cafe sequence and prison scene. Extended gameplay stability and the isolated performance impact of batching have not been evaluated.

<!-- greyfinch-sync:edsuuu/VI-BR-PORT:issue:5557269574 --> Imported from [edsuuu/VI-BR-PORT](https://github.com/edsuuu/VI-BR-PORT/pull/48). Originally posted by [nativ69](https://github.com/nativ69) on 2026-11-30T01:18:18Z. --- ## Problem `HeapRanges` was stored in a global cache keyed by the host heap's address. Destroying a descriptor heap did not remove its cached ranges, potentially retaining stale `Shadow` references and allowing a replacement heap at the same address to inherit stale range state. ## Changes - Tie range state and refresh tracking to the owning `HostHeap`. - Retain host heaps through recorded and in-flight command lists. - Validate heap identity in deferred callbacks to prevent stale updates after address reuse. - Enforce heap retention when recording deferred slot fills. - Gracefully skip expired heap references instead of panicking. - Batch `Weak::upgrade` operations across consecutive slot fills targeting the same heap, reducing atomic reference-count contention while preserving execution order. - Add bounded, opt-in lifetime diagnostics (`VICTORY_HEAP_LIFETIME=1`). ## Validation - All 16 heap lifetime tests passed on a real GPU. - Added regression coverage for address reuse, resource retention, heap cleanup, expired slot fills, and concurrent upgrade batching. - Workspace tests, Clippy (with and without all features), and documentation checks passed across the commits. - Three focused gameplay smoke tests, lasting approximately 2–3 minutes each including startup, completed without crashes or ERROR-level log entries. Tested on Windows 11, Ryzen 7 5800X, RTX 4070 (12 GB), and 32 GB DDR4-3200, using the Xbox Series S configuration. The gameplay tests were limited to the opening cafe sequence and prison scene. Extended gameplay stability and the isolated performance impact of batching have not been evaluated.
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
edsuuu/VI-BR-PORT!48
No description provided.