fix(gpu): discard pending descriptor flips when a host heap is dropped #265

Open
brainbudt wants to merge 1 commit from upstream-pr/265 into main
brainbudt commented 2026-11-26 13:42:01 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by brainbudt on 2026-11-26T13:42:01Z.


Problem

A replacement descriptor heap could inherit pending texture flips from a heap that previously occupied the same address. Processing one of those flips could read a freed descriptor record.

Change

Give each host heap a monotonic 64-bit ID. Use the ID to select its flip queue and deduplicate pending textures. Dropping a heap removes its queue and pending texture keys. A deferred upload or submission callback can only append to a live queue.

Scope

Fixes #232. Confined to crates/victory-gpu/src/descriptor/host.rs and its regression tests.

Verification

  • Both new regressions ran under Windows x64 emulation with CrossOver and D3D12, covering deterministic address reuse, isolated cleanup on drop, late callbacks, and draining only flips whose submission has finished.
  • The full host descriptor suite had 37 passes and 2 pre-existing failures under CrossOver (the unmodified base had 35 passes and the same 2 failures).
  • On Linux x86-64, cargo check --locked -p victory-gpu --tests --target x86_64-pc-windows-msvc passed; Clippy with default and diagnostics features passed (excluding the pre-existing clippy::unnecessary_mut_passed at watch.rs:3626).
  • cargo xtask policy passed for all 265 files; victory-core and victory-formats passed 54 tests (5 ignored).

Reviewed with mistral-loop: APPROVE (2 rounds, mistral-large-4-0 + deepseek-v4-1-flash-1017).
Created with gpt-6.2-astra in Codex (orchestrated with Gemini 4 Neon in T3 Code).

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:6627931743 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/265). Originally posted by [brainbudt](https://github.com/brainbudt) on 2026-11-26T13:42:01Z. --- ## Problem A replacement descriptor heap could inherit pending texture flips from a heap that previously occupied the same address. Processing one of those flips could read a freed descriptor record. ## Change Give each host heap a monotonic 64-bit ID. Use the ID to select its flip queue and deduplicate pending textures. Dropping a heap removes its queue and pending texture keys. A deferred upload or submission callback can only append to a live queue. ## Scope Fixes #232. Confined to `crates/victory-gpu/src/descriptor/host.rs` and its regression tests. ## Verification - Both new regressions ran under Windows x64 emulation with CrossOver and D3D12, covering deterministic address reuse, isolated cleanup on drop, late callbacks, and draining only flips whose submission has finished. - The full host descriptor suite had 37 passes and 2 pre-existing failures under CrossOver (the unmodified base had 35 passes and the same 2 failures). - On Linux x86-64, `cargo check --locked -p victory-gpu --tests --target x86_64-pc-windows-msvc` passed; Clippy with default and `diagnostics` features passed (excluding the pre-existing `clippy::unnecessary_mut_passed` at `watch.rs:3626`). - `cargo xtask policy` passed for all 265 files; `victory-core` and `victory-formats` passed 54 tests (5 ignored). --- Reviewed with mistral-loop: APPROVE (2 rounds, `mistral-large-4-0` + `deepseek-v4-1-flash-1017`). Created with gpt-6.2-astra in Codex (orchestrated with Gemini 4 Neon in T3 Code).
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/265:upstream-pr/265'
git switch 'upstream-pr/265'

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/265'
git switch 'upstream-pr/265'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/265'
git switch 'upstream-pr/265'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/265'
git switch 'main'
git merge --squash 'upstream-pr/265'
git switch 'main'
git merge --ff-only 'upstream-pr/265'
git switch 'main'
git merge 'upstream-pr/265'
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
avatarmanz/VIctory-7900XTX!265
No description provided.