fix(descriptor): honor VICTORY_DYNAMIC_SLOTS on PORTABLE_VIEWS hosts and port VICTORY_RAW_VIEW_CLAMP #255

Closed
Vladimir-Human wants to merge 531 commits from upstream-pr/255 into main
Vladimir-Human commented 2026-11-27 12:31:15 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by Vladimir-Human on 2026-11-27T12:31:15Z.


Summary

Scoped strictly to descriptor-heap dynamic slot sizing and OOB raw buffer view clamping (the ambient chromatic scrub was split out into a separate opt-in PR per review feedback; related to #168):

  1. Fix dynamic_slots() off-by-one on PORTABLE_VIEWS-capped hosts (descriptor/host.rs):
    • On NVIDIA (probe_view_limit -> PORTABLE_VIEWS = 1_000_000), null == 999_999 < PORTABLE_VIEWS, so the previous if null < PORTABLE_VIEWS { return DYNAMIC; } branch unconditionally ignored VICTORY_DYNAMIC_SLOTS and hard-capped dynamic slots at 262,144 (causing DynamicDescriptorTable draw drops under heavy frame demand in #168).
    • dynamic_slots_for now honors explicit VICTORY_DYNAMIC_SLOTS up to PORTABLE_DYNAMIC_CAP (524,288, preserving at least 475,711 title slots and preventing null - extra underflow) and uses spare headroom without shrinking count when unset.
    • Added pure unit tests and a live HostHeap::new subprocess regression test (VICTORY_DYNAMIC_SLOTS=393216).
  2. Port VICTORY_RAW_VIEW_CLAMP (VIctory-NVIDIA aec85ef) + diagnostics meter (host.rs):
    • Bounds raw SRV/UAV buffer views (raw_view_range, raw_at, raw_uav_at) against the backing resource size and 16-byte alignment, substituting safe null raw descriptors for past-end/unaligned/empty views and shortening tail-straddling views (with VICTORY_RAW_VIEW_CLAMP=0 kill-switch).
    • Added D3D12 hardware + WARP compute dispatch tests verifying exact SRV loads, UAV writes, per-reason clamp counters, and zero D3D12 debug layer errors.

Changed Files

  • crates/victory-gpu/src/descriptor/host.rs: dynamic_slots_for fix, VICTORY_RAW_VIEW_CLAMP, unit + HostHeap::new + HW/WARP OOB clamp tests.
  • crates/victory-gpu/src/host.rs: raw_view_clamps diagnostics frame-line counter.
  • crates/victory-gpu/src/indirect.rs: #[cfg(test)] pub(crate) visibility on WarpHarness::on for test reuse.

Verification

Verified on local D3D12 hardware (NVIDIA GeForce RTX 4070 SUPER) and WARP (VICTORY_D3D12_DEBUG=1, --test-threads=1, 0 D3D12 debug errors):

  • cargo clippy -p victory-gpu --all-targets --locked -- -D warnings (default & --features diagnostics): 0 warnings.
  • cargo test -p victory-gpu --locked descriptor::host::tests -- --test-threads=1: 57/57 passed (default & diagnostics, hardware + WARP).
  • cargo run -p xtask --locked -- policy & cargo test -p xtask --locked: 11/11 passed.
<!-- greyfinch-sync:TaynanGT/Vice-Tay:issue:5526666391 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/255). Originally posted by [Vladimir-Human](https://github.com/Vladimir-Human) on 2026-11-27T12:31:15Z. --- ## Summary Scoped strictly to descriptor-heap dynamic slot sizing and OOB raw buffer view clamping (the ambient chromatic scrub was split out into a separate opt-in PR per review feedback; related to #168): 1. **Fix `dynamic_slots()` off-by-one on `PORTABLE_VIEWS`-capped hosts (`descriptor/host.rs`):** - On NVIDIA (`probe_view_limit` -> `PORTABLE_VIEWS = 1_000_000`), `null == 999_999 < PORTABLE_VIEWS`, so the previous `if null < PORTABLE_VIEWS { return DYNAMIC; }` branch unconditionally ignored `VICTORY_DYNAMIC_SLOTS` and hard-capped dynamic slots at `262,144` (causing `DynamicDescriptorTable` draw drops under heavy frame demand in #168). - `dynamic_slots_for` now honors explicit `VICTORY_DYNAMIC_SLOTS` up to `PORTABLE_DYNAMIC_CAP` (`524,288`, preserving at least `475,711` title slots and preventing `null - extra` underflow) and uses spare headroom without shrinking `count` when unset. - Added pure unit tests and a live `HostHeap::new` subprocess regression test (`VICTORY_DYNAMIC_SLOTS=393216`). 2. **Port `VICTORY_RAW_VIEW_CLAMP` (`VIctory-NVIDIA` `aec85ef`) + diagnostics meter (`host.rs`):** - Bounds raw SRV/UAV buffer views (`raw_view_range`, `raw_at`, `raw_uav_at`) against the backing resource size and 16-byte alignment, substituting safe null raw descriptors for past-end/unaligned/empty views and shortening tail-straddling views (with `VICTORY_RAW_VIEW_CLAMP=0` kill-switch). - Added D3D12 hardware + WARP compute dispatch tests verifying exact SRV loads, UAV writes, per-reason clamp counters, and zero D3D12 debug layer errors. ## Changed Files - `crates/victory-gpu/src/descriptor/host.rs`: `dynamic_slots_for` fix, `VICTORY_RAW_VIEW_CLAMP`, unit + `HostHeap::new` + HW/WARP OOB clamp tests. - `crates/victory-gpu/src/host.rs`: `raw_view_clamps` diagnostics frame-line counter. - `crates/victory-gpu/src/indirect.rs`: `#[cfg(test)]` `pub(crate)` visibility on `WarpHarness::on` for test reuse. ## Verification Verified on local D3D12 hardware (NVIDIA GeForce RTX 4070 SUPER) and WARP (`VICTORY_D3D12_DEBUG=1`, `--test-threads=1`, `0` D3D12 debug errors): - `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings` (default & `--features diagnostics`): **0 warnings**. - `cargo test -p victory-gpu --locked descriptor::host::tests -- --test-threads=1`: **57/57 passed** (default & `diagnostics`, hardware + WARP). - `cargo run -p xtask --locked -- policy` & `cargo test -p xtask --locked`: **11/11 passed**.
TaynanGT commented 2026-11-27 12:42:01 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T12:42:01Z.


@Vladimir-Human The portable-heap limit and the raw-view bounds have focused synthetic checks. I’d land those independently of the chroma change so we can measure the descriptor behaviour on its own. The chroma pass needs a matched moving shot of the foliage and still needs to preserve intended colour on sky, water and warm lighting.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7218568111 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/255#issuecomment-7218568111). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-27T12:42:01Z. --- @Vladimir-Human The portable-heap limit and the raw-view bounds have focused synthetic checks. I’d land those independently of the chroma change so we can measure the descriptor behaviour on its own. The chroma pass needs a matched moving shot of the foliage and still needs to preserve intended colour on sky, water and warm lighting.
Vladimir-Human commented 2026-11-27 13:32:48 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by Vladimir-Human on 2026-11-27T13:32:48Z.


Thank you @TaynanGT for the review! Split cleanly in cdaaebc3:

  • Removed crates/victory-gpu/src/ambient.rs completely from #255 so this PR is strictly focused on the descriptor/host.rs dynamic_slots() PORTABLE_VIEWS fix and VICTORY_RAW_VIEW_CLAMP (+ host.rs meter and indirect.rs test visibility).
  • Moved the chromatic probe-garbage scrub to a separate opt-in PR (#280, OFF by default behind VICTORY_AMBIENT_CHROMA_SCRUB=1), verified on D3D12 HW + WARP to preserve daylight, blue sky, coastal/deep water tones, warm sunset/lamp lighting, and natural/deep foliage bounce.
  • Re-verified clippy (-D warnings, default + diagnostics), descriptor::host::tests (57/57 HW + WARP, 0 D3D12 debug errors), and xtask policy.
<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7219619547 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/255#issuecomment-7219619547). Originally posted by [Vladimir-Human](https://github.com/Vladimir-Human) on 2026-11-27T13:32:48Z. --- Thank you @TaynanGT for the review! Split cleanly in `cdaaebc3`: - Removed `crates/victory-gpu/src/ambient.rs` completely from #255 so this PR is strictly focused on the `descriptor/host.rs` `dynamic_slots()` `PORTABLE_VIEWS` fix and `VICTORY_RAW_VIEW_CLAMP` (+ `host.rs` meter and `indirect.rs` test visibility). - Moved the chromatic probe-garbage scrub to a separate opt-in PR (#280, OFF by default behind `VICTORY_AMBIENT_CHROMA_SCRUB=1`), verified on D3D12 HW + WARP to preserve daylight, blue sky, coastal/deep water tones, warm sunset/lamp lighting, and natural/deep foliage bounce. - Re-verified clippy (`-D warnings`, default + `diagnostics`), `descriptor::host::tests` (57/57 HW + WARP, 0 D3D12 debug errors), and `xtask policy`.
TaynanGT commented 2026-11-27 13:37:26 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T13:37:26Z.


@Vladimir-Human The split gives us a descriptor-only comparison in this PR and a separate visual change in #280. I’ll use the 57 descriptor checks as the functional baseline and keep the foliage comparison on the chroma branch.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7219727968 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/255#issuecomment-7219727968). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-27T13:37:26Z. --- @Vladimir-Human The split gives us a descriptor-only comparison in this PR and a separate visual change in #280. I’ll use the 57 descriptor checks as the functional baseline and keep the foliage comparison on the chroma branch.
TaynanGT commented 2026-11-30 17:14:44 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-30T17:14:44Z.


main has moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the current main and open a new PR; I'll review it there.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7285952550 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/255#issuecomment-7285952550). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-30T17:14:44Z. --- `main` has moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the current `main` and open a new PR; I'll review it there.

Pull request closed

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
TaynanGT/Vice-Tay!255
No description provided.