perf(metal): attach each heap residency set once per command buffer #198

Manually merged
github merged 1 commit from gh-pr/198/head into gh-pr/198/base 2026-11-27 00:54:28 +00:00
Owner

@⁠brainbudt on GitHub · 2026-11-26 23:54 UTC · original
brainbudt:perf/metal-dedup-residency-set → main · +54 −7 · 1 files · 1 commits · merged 2026-11-27 00:31 UTC

Summary

In crates/victory-metal/src/gfx.rs, use_heap_cb called cb.useResidencySet(set) on every compute dispatch and draw call, even when the same descriptor heap's residency set had already been attached to that command buffer.

Changes

  • Track attached heaps per command buffer in submit_passes and skip duplicate useResidencySet calls in use_heap_cb while still committing any dirty heap updates beforehand.
  • Add a unit test verifying distinct heap attachment, per-command-buffer deduplication, re-attachment on a subsequent command buffer, and dirty commits after initial attachment.

Verification

  • cargo test -j4 -p victory-metal (all 43 tests pass)
  • cargo clippy -j4 -p victory-metal --all-targets --target x86_64-pc-windows-gnullvm -- -D warnings
  • cargo xtask policy
**@⁠brainbudt** on GitHub · 2026-11-26 23:54 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/198) `brainbudt:perf/metal-dedup-residency-set` → `main` · +54 −7 · 1 files · 1 commits · merged 2026-11-27 00:31 UTC ### Summary In `crates/victory-metal/src/gfx.rs`, `use_heap_cb` called `cb.useResidencySet(set)` on every compute dispatch and draw call, even when the same descriptor heap's residency set had already been attached to that command buffer. ### Changes - Track attached heaps per command buffer in `submit_passes` and skip duplicate `useResidencySet` calls in `use_heap_cb` while still committing any dirty heap updates beforehand. - Add a unit test verifying distinct heap attachment, per-command-buffer deduplication, re-attachment on a subsequent command buffer, and dirty commits after initial attachment. ### Verification - `cargo test -j4 -p victory-metal` (all 43 tests pass) - `cargo clippy -j4 -p victory-metal --all-targets --target x86_64-pc-windows-gnullvm -- -D warnings` - `cargo xtask policy`
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 00:54:26 +00:00
github manually merged commit 3f1c1292db into gh-pr/198/base 2026-11-27 00:54:28 +00:00
Author
Owner

@⁠LakshanSivakumar on GitHub · 2026-11-27 00:31 UTC · original · approved these changes

Reviewed and tested together with the other open PRs on main (macOS x86_64 workspace tests, the setup shell tests, and Windows clippy). Thanks!

**@⁠LakshanSivakumar** on GitHub · 2026-11-27 00:31 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/198#pullrequestreview-6081978594) · **approved these changes** Reviewed and tested together with the other open PRs on main (macOS x86_64 workspace tests, the setup shell tests, and Windows clippy). Thanks!
This discussion has been locked. Commenting is limited to contributors.
No description provided.