GPU: enforce logical indirect buffer spans #1815

Open
aycow wants to merge 7 commits from upstream-pr/1817 into main
aycow commented 2026-11-24 22:58:50 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by aycow on 2026-11-24T22:58:50Z.


What changed

Validate the argument and count spans against the title resource before selecting a larger overlapping native shadow. For counted calls, cap the native maximum to the number of complete payloads that fit the logical argument buffer. The GPU count can still select fewer records at execution. Fixed-count calls retain their exact requested count and are refused when it cannot fit. The shadow refresh stops at the last payload. The clamp's 32-bit byte offsets and the four-byte count word are also checked.

This follows the native D3D12 rule for counted execution. It preserves records in a short logical argument buffer even if the title supplies a larger ceiling. ExecuteIndirect contract

Verification

cargo test --locked -p victory-gpu --features diagnostics --lib indirect_span -- --include-ignored --test-threads=1
$env:VICTORY_D3D12_WARP = '1'
cargo test --locked -p victory-gpu --features diagnostics --lib indirect_span -- --include-ignored --test-threads=1

Both controls passed on default hardware and WARP. They cover a generous maximum with a tight buffer, an out-of-range fixed count, exact-end count words, malformed strides, and two placed buffers sharing a larger backing shadow. The placed-buffer fixture checks selection and range calculation. Strict GPU diagnostics Clippy passed.

Thanks to raffclar for the final-record case from #40 and Melow-code for reviewing the logical span. #242's native count and ordering investigation remains separate. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6593109733 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1817). Originally posted by [aycow](https://github.com/aycow) on 2026-11-24T22:58:50Z. --- ## What changed Validate the argument and count spans against the title resource before selecting a larger overlapping native shadow. For counted calls, cap the native maximum to the number of complete payloads that fit the logical argument buffer. The GPU count can still select fewer records at execution. Fixed-count calls retain their exact requested count and are refused when it cannot fit. The shadow refresh stops at the last payload. The clamp's 32-bit byte offsets and the four-byte count word are also checked. This follows the native D3D12 rule for counted execution. It preserves records in a short logical argument buffer even if the title supplies a larger ceiling. [ExecuteIndirect contract](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist-executeindirect) ## Verification ```powershell cargo test --locked -p victory-gpu --features diagnostics --lib indirect_span -- --include-ignored --test-threads=1 $env:VICTORY_D3D12_WARP = '1' cargo test --locked -p victory-gpu --features diagnostics --lib indirect_span -- --include-ignored --test-threads=1 ``` Both controls passed on default hardware and WARP. They cover a generous maximum with a tight buffer, an out-of-range fixed count, exact-end count words, malformed strides, and two placed buffers sharing a larger backing shadow. The placed-buffer fixture checks selection and range calculation. Strict GPU diagnostics Clippy passed. Thanks to raffclar for the final-record case from #40 and Melow-code for reviewing the logical span. #242's native count and ordering investigation remains separate. AI-assisted with OpenAI Codex.
catminou4 commented 2026-11-24 23:03:27 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T23:03:27Z.

Review: COMMENTED


Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.

Logical indirect buffer spans enforced: 8K gpu diff — bounds the indirect argument buffer reads. Pairs with #1813's tests.

<!-- greyfinch-sync:Marvisak/VIctory:review:6048801849 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1817#pullrequestreview-6048801849). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T23:03:27Z. **Review:** COMMENTED --- Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff. Logical indirect buffer spans enforced: 8K gpu diff — bounds the indirect argument buffer reads. Pairs with #1813's tests.
Melow-code commented 2026-11-24 23:07:35 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Melow-code on 2026-11-24T23:07:35Z.

Review: COMMENTED


The logical span check and zero-record early-out are correct. One question: when a span exceeds the logical size, is it clamped or rejected? If rejected, a title that intentionally over-reads (relying on the native clamp in #242) would regress.

<!-- greyfinch-sync:Marvisak/VIctory:review:6048843905 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1817#pullrequestreview-6048843905). Originally posted by [Melow-code](https://github.com/Melow-code) on 2026-11-24T23:07:35Z. **Review:** COMMENTED --- The logical span check and zero-record early-out are correct. One question: when a span exceeds the logical size, is it clamped or rejected? If rejected, a title that intentionally over-reads (relying on the native clamp in #242) would regress.
DesertGamer commented 2026-11-25 00:06:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DesertGamer on 2026-11-24T23:07:11Z.


VIctory V2: community PRs, merged and tested

Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch.

Where it stands today: launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1).

⚠️ Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk.

Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help:
https://DesertGamer/VIctory-V2

Unofficial community fork of Marvisak/VIctory, GPL-3.0.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7147035479 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1817#issuecomment-7147035479). Originally posted by [DesertGamer](https://github.com/DesertGamer) on 2026-11-24T23:07:11Z. --- ### VIctory V2: community PRs, merged and tested Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch. **Where it stands today:** launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1). :warning: Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk. Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help: https://DesertGamer/VIctory-V2 *Unofficial community fork of Marvisak/VIctory, GPL-3.0.*
aycow commented 2026-11-25 00:06:44 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by aycow on 2026-11-24T23:12:28Z.


@ruipedro-pinheiro It rejects the call before native recording when the span implied by the requested maximum exceeds the logical argument buffer. An out-of-range count word is also rejected. The native D3D12 contract validates the entire range implied by MaxCommandCount, even when a GPU count buffer can later select fewer records. Our AMD/WARP control confirmed that a larger native shadow no longer makes the invalid logical span pass.

The current #242 code limits how many records it processes using the GPU count, and it still requests source backing for the maximum span. It cannot establish the size of the logical guest resource from that backing. A D3D12.X title that demonstrably accepts a smaller logical span would need a separate compatibility case backed by console behavior or an authorized trace. Safe support would have to bound both the clamp’s source reads and the native call. This PR keeps the entry-point check. Review · D3D12 contract · #242

AI-assisted using Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7147137405 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1817#issuecomment-7147137405). Originally posted by [aycow](https://github.com/aycow) on 2026-11-24T23:12:28Z. --- @ruipedro-pinheiro It rejects the call before native recording when the span implied by the requested maximum exceeds the logical argument buffer. An out-of-range count word is also rejected. The native D3D12 contract validates the entire range implied by `MaxCommandCount`, even when a GPU count buffer can later select fewer records. Our AMD/WARP control confirmed that a larger native shadow no longer makes the invalid logical span pass. The current #242 code limits how many records it processes using the GPU count, and it still requests source backing for the maximum span. It cannot establish the size of the logical guest resource from that backing. A D3D12.X title that demonstrably accepts a smaller logical span would need a separate compatibility case backed by console behavior or an authorized trace. Safe support would have to bound both the clamp’s source reads and the native call. This PR keeps the entry-point check. [Review](https://github.com/Marvisak/VIctory/pull/1817#pullrequestreview-6048843905) · [D3D12 contract](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist-executeindirect) · [#242](https://github.com/Marvisak/VIctory/pull/242) AI-assisted using Codex.
aycow commented 2026-11-25 01:08:21 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by aycow on 2026-11-25T01:02:39Z.


Merged upstream 42363ab into the PR at 77dfdf2. Both upstream’s buffer test helper and the placed-shadow regression are preserved. Strict diagnostics Clippy and both logical-span tests passed on the default hardware adapter and WARP. GitHub reports a clean merge.

The GitHub workspace run hit the same gather and wave-32 permute test failures as upstream at 42363ab. Upstream CI

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149147580 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1817#issuecomment-7149147580). Originally posted by [aycow](https://github.com/aycow) on 2026-11-25T01:02:39Z. --- Merged upstream `42363ab` into the PR at `77dfdf2`. Both upstream’s buffer test helper and the placed-shadow regression are preserved. Strict diagnostics Clippy and both logical-span tests passed on the default hardware adapter and WARP. GitHub reports a clean merge. The GitHub workspace run hit the same gather and wave-32 permute test failures as upstream at `42363ab`. [Upstream CI](https://github.com/Marvisak/VIctory/actions/runs/45520251168/job/138889994349)
Melow-code commented 2026-11-25 02:05:53 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Melow-code on 2026-11-25T01:19:54Z.


The gather and wave-32 permute failures on the workspace run are upstream's, not this PR's: the hardware-only shader checks ran on WARP on the GPU-less CI runner. Marvis fixed them in 42363ab ("Tests: hardware-only shader checks skip on a machine without a GPU"), which refuses a software default adapter and skips the permute test when only WARP is there. Rebase it in and those two failures disappear. The logical-span work itself is clean per your report; nothing else from my side. (Reply written with DeepSeek V4 Pro, OpenCode.)

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149437535 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1817#issuecomment-7149437535). Originally posted by [Melow-code](https://github.com/Melow-code) on 2026-11-25T01:19:54Z. --- The gather and wave-32 permute failures on the workspace run are upstream's, not this PR's: the hardware-only shader checks ran on WARP on the GPU-less CI runner. Marvis fixed them in 42363ab ("Tests: hardware-only shader checks skip on a machine without a GPU"), which refuses a software default adapter and skips the permute test when only WARP is there. Rebase it in and those two failures disappear. The logical-span work itself is clean per your report; nothing else from my side. (Reply written with DeepSeek V4 Pro, OpenCode.)
Melow-code commented 2026-11-25 02:05:57 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Melow-code on 2026-11-25T01:22:59Z.


Reviewed the PR's own commits (b1b05ca and its follow-ups, above the merge of main).

The fix is the right one at the right layer: the logical span of the last record is checked against the logical resource before any native shadow can widen the extent, which is exactly what the D3D12 contract validates. The checked arithmetic is everywhere (checked_add, checked_sub), the count-buffer span is a constant 4, and an unknown indirect kind drops the execution rather than guessing.

One point to confirm, non-blocking:

  1. The payload table gives kind 105 (single-pass mesh dispatch) 12 bytes, like a plain dispatch. If the RDNA2 argument record for 105 is the same three dwords, this is right — but a citation (the ISA section, or a signature dump from the title) would pin it, since a wrong payload undercounts the last record's span and re-introduces the very hole this PR closes.

The unit tests cover the span arithmetic for all five kinds, the stride/alignment refusals, and both overflow edges; the GPU-shadow test is properly gated behind a real device. The zero-record skip is a nice touch.

Nothing blocking. (Review written with DeepSeek V4 Pro, OpenCode.)

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149487889 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1817#issuecomment-7149487889). Originally posted by [Melow-code](https://github.com/Melow-code) on 2026-11-25T01:22:59Z. --- Reviewed the PR's own commits (b1b05ca and its follow-ups, above the merge of main). The fix is the right one at the right layer: the logical span of the last record is checked against the logical resource before any native shadow can widen the extent, which is exactly what the D3D12 contract validates. The checked arithmetic is everywhere (`checked_add`, `checked_sub`), the count-buffer span is a constant 4, and an unknown indirect kind drops the execution rather than guessing. One point to confirm, non-blocking: 1. The payload table gives kind 105 (single-pass mesh dispatch) 12 bytes, like a plain dispatch. If the RDNA2 argument record for 105 is the same three dwords, this is right — but a citation (the ISA section, or a signature dump from the title) would pin it, since a wrong payload undercounts the last record's span and re-introduces the very hole this PR closes. The unit tests cover the span arithmetic for all five kinds, the stride/alignment refusals, and both overflow edges; the GPU-shadow test is properly gated behind a real device. The zero-record skip is a nice touch. Nothing blocking. (Review written with DeepSeek V4 Pro, OpenCode.)
aycow commented 2026-11-25 02:06:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by aycow on 2026-11-25T01:25:48Z.


Reviewed the PR's own commits (b1b05ca and its follow-ups, above the merge of main).

The fix is the right one at the right layer: the logical span of the last record is checked against the logical resource before any native shadow can widen the extent, which is exactly what the D3D12 contract validates. The checked arithmetic is everywhere (checked_add, checked_sub), the count-buffer span is a constant 4, and an unknown indirect kind drops the execution rather than guessing.

One point to confirm, non-blocking:

  1. The payload table gives kind 105 (single-pass mesh dispatch) 12 bytes, like a plain dispatch. If the RDNA2 argument record for 105 is the same three dwords, this is right — but a citation (the ISA section, or a signature dump from the title) would pin it, since a wrong payload undercounts the last record's span and re-introduces the very hole this PR closes.

The unit tests cover the span arithmetic for all five kinds, the stride/alignment refusals, and both overflow edges; the GPU-shadow test is properly gated behind a real device. The zero-record skip is a nice touch.

Nothing blocking. (Review written with DeepSeek V4 Pro, OpenCode.)

The 12-byte payload for kind 105 follows the existing upstream documentation in [list.rs](github.com/Marvisak/VIctory@42363ab6cd/crates/victory-gpu/src/list.rs (L1281-L1287)), which specifies three group counts with the flags stored in the signature.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149536903 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1817#issuecomment-7149536903). Originally posted by [aycow](https://github.com/aycow) on 2026-11-25T01:25:48Z. --- > Reviewed the PR's own commits ([b1b05ca](https://github.com/Marvisak/VIctory/commit/b1b05ca392c61e5caec433b5b6eb4b2b6ef9b051) and its follow-ups, above the merge of main). > > The fix is the right one at the right layer: the logical span of the last record is checked against the logical resource before any native shadow can widen the extent, which is exactly what the D3D12 contract validates. The checked arithmetic is everywhere (`checked_add`, `checked_sub`), the count-buffer span is a constant 4, and an unknown indirect kind drops the execution rather than guessing. > > One point to confirm, non-blocking: > > 1. The payload table gives kind 105 (single-pass mesh dispatch) 12 bytes, like a plain dispatch. If the RDNA2 argument record for 105 is the same three dwords, this is right — but a citation (the ISA section, or a signature dump from the title) would pin it, since a wrong payload undercounts the last record's span and re-introduces the very hole this PR closes. > > The unit tests cover the span arithmetic for all five kinds, the stride/alignment refusals, and both overflow edges; the GPU-shadow test is properly gated behind a real device. The zero-record skip is a nice touch. > > Nothing blocking. (Review written with DeepSeek V4 Pro, OpenCode.) The 12-byte payload for kind 105 follows the existing upstream documentation in [[list.rs](https://github.com/Marvisak/VIctory/blob/42363ab6cd5265f0fb3b500ad265f2b84c6b5dbf/crates/victory-gpu/src/list.rs#L1281-L1287)](https://github.com/Marvisak/VIctory/blob/42363ab6cd5265f0fb3b500ad265f2b84c6b5dbf/crates/victory-gpu/src/list.rs#L1281-L1287), which specifies three group counts with the flags stored in the signature.
Marvisak commented 2026-11-25 07:03:17 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T06:29:24Z.


Automated triage for the maintainers.

Merge candidate (a recommendation to look, not an approval). The new push (ca48abb) only merges a newer main; the PR's own diff against main is identical to the one reviewed at 6efc765. execute_indirect in crates/victory-gpu/src/list.rs checks the argument and count spans against the title resource's own size before shadow::find can choose a larger overlapping shadow, caps a counted call's maximum to the complete records that fit the logical buffer, and refuses a fixed count that does not fit. State::execute_indirect in draw.rs takes the bounded range.

The branch merges cleanly. CI: check passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7154843115 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1817#issuecomment-7154843115). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T06:29:24Z. --- <!-- victory-triage v1 head=ca48abb8ff287cc5d5829886a02bedcbb03f2d34 verdict=merge-candidate at=2026-11-26T01:19:45Z --> Automated triage for the maintainers. **Merge candidate** (a recommendation to look, not an approval). The new push (`ca48abb`) only merges a newer `main`; the PR's own diff against `main` is identical to the one reviewed at `6efc765`. `execute_indirect` in `crates/victory-gpu/src/list.rs` checks the argument and count spans against the title resource's own size before `shadow::find` can choose a larger overlapping shadow, caps a counted call's maximum to the complete records that fit the logical buffer, and refuses a fixed count that does not fit. `State::execute_indirect` in `draw.rs` takes the bounded range. The branch merges cleanly. CI: `check` passing. --- _Generated by [Claude Code](https://claude.ai/code)_
aycow commented 2026-11-25 17:05:21 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by aycow on 2026-11-25T16:57:54Z.


The counted-call case is addressed at 6efc765. An oversized maximum now becomes the number of complete records that fit the logical buffer. The GPU count can select any smaller number as before. The clamp and argument refresh use the bounded input, including a final record without trailing padding. Both logical-span tests passed on default hardware and WARP. I moved the design note into the description and documented the Windows-only use of the count offset.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7168796803 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1817#issuecomment-7168796803). Originally posted by [aycow](https://github.com/aycow) on 2026-11-25T16:57:54Z. --- The counted-call case is addressed at `6efc765`. An oversized maximum now becomes the number of complete records that fit the logical buffer. The GPU count can select any smaller number as before. The clamp and argument refresh use the bounded input, including a final record without trailing padding. Both logical-span tests passed on default hardware and WARP. I moved the design note into the description and documented the Windows-only use of the count offset.
Melow-code commented 2026-11-25 23:55:37 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Melow-code on 2026-11-25T23:55:37Z.

Review: APPROVED


Re-checked at ca48abb. The counted case is capped to complete payloads, fixed counts are refused when they don't fit, and the last-record span (payload, no trailing padding) matches the clamp shader's reads. My earlier question is answered. LGTM — nits only: the diagnostics label says "max" while printing the capped limit, and range is unused on non-Windows builds without the diagnostics feature (#2890).

<!-- greyfinch-sync:Marvisak/VIctory:review:6066664822 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1817#pullrequestreview-6066664822). Originally posted by [Melow-code](https://github.com/Melow-code) on 2026-11-25T23:55:37Z. **Review:** APPROVED --- Re-checked at ca48abb. The counted case is capped to complete payloads, fixed counts are refused when they don't fit, and the last-record span (payload, no trailing padding) matches the clamp shader's reads. My earlier question is answered. LGTM — nits only: the diagnostics label says "max" while printing the capped limit, and `range` is unused on non-Windows builds without the diagnostics feature (#2890).
fuzeofficlal commented 2026-11-26 16:40:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T16:40:02Z.

Review: APPROVED


Verified ca48abb8ff287cc5d5829886a02bedcbb03f2d34 merged cleanly onto 63bcca43 on Windows 11 with both an RTX 5090 (VICTORY_D3D12_DEBUG=1) and WARP (--features diagnostics, VICTORY_D3D12_DEBUG=1).

Code review

  • indirect_arguments (crates/victory-gpu/src/list.rs:1657-1667) and indirect_buffer_address (list.rs:1708-1711) validate both argument and count spans against resource::buffer_bytes (crates/victory-gpu/src/resource.rs:1465) before State::execute_indirect (crates/victory-gpu/src/draw.rs:1679-1740) calls shadow::find(arguments, len), so an enclosing native shadow can no longer widen a placed buffer's logical bounds.
  • indirect_argument_limit (list.rs:1669-1690) clamps available to 1 << 32 to match the 32-bit byte offset arithmetic in indirect.rs's clamp shader ((limit - 1) * stride + payload <= 1 << 32 across strides 12/16/20 with no u32 wraparound), caps counted calls to the complete payloads that fit, and rejects fixed-count calls that overflow the logical buffer.
  • indirect_argument_span (list.rs:1692-1705) requires only the final record's payload (16/20/12 bytes) without trailing stride padding, matching what the clamp compute shader actually loads while indirect::bound still allocates stride * records.max(1) for D3D12 ExecuteIndirect.
  • max == 0 returns early (list.rs:1604) without incrementing the dropped indirect counter, and all offset/span checks use checked u64 arithmetic and 4-byte alignment checks (list.rs:1714-1721).

Verification

  • cargo xtask policy: 191 files ok.
  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings (default and --all-features): clean.
  • RTX 5090 + VICTORY_D3D12_DEBUG=1: list:: resource:: indirect:: 29 passed, 0 failed (1 ignored), plus --ignored indirect_span_does_not_inherit_a_larger_native_shadow 1/1 passed.
  • WARP + --features diagnostics + VICTORY_D3D12_DEBUG=1: list:: resource:: indirect:: 29 passed, 0 failed (1 ignored), plus --ignored indirect_span_does_not_inherit_a_larger_native_shadow 1/1 passed.
  • Additional boundary probe checking all five indirect kinds (0, 1, 2, 10, 105), unknown kind rejection, final-record-without-padding (stride=32, payload=16, count=2 -> 48), counted 4 GiB capping for strides 16/20/12, < payload counted rejection, uncounted > 4 GiB rejection, and u64::MAX / alignment edges in indirect_offset: passed.
<!-- greyfinch-sync:Marvisak/VIctory:review:6077690920 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1817#pullrequestreview-6077690920). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T16:40:02Z. **Review:** APPROVED --- Verified `ca48abb8ff287cc5d5829886a02bedcbb03f2d34` merged cleanly onto `63bcca43` on Windows 11 with both an RTX 5090 (`VICTORY_D3D12_DEBUG=1`) and WARP (`--features diagnostics`, `VICTORY_D3D12_DEBUG=1`). ### Code review - `indirect_arguments` (`crates/victory-gpu/src/list.rs:1657-1667`) and `indirect_buffer_address` (`list.rs:1708-1711`) validate both argument and count spans against `resource::buffer_bytes` (`crates/victory-gpu/src/resource.rs:1465`) before `State::execute_indirect` (`crates/victory-gpu/src/draw.rs:1679-1740`) calls `shadow::find(arguments, len)`, so an enclosing native shadow can no longer widen a placed buffer's logical bounds. - `indirect_argument_limit` (`list.rs:1669-1690`) clamps `available` to `1 << 32` to match the 32-bit byte offset arithmetic in `indirect.rs`'s clamp shader (`(limit - 1) * stride + payload <= 1 << 32` across strides 12/16/20 with no `u32` wraparound), caps counted calls to the complete payloads that fit, and rejects fixed-count calls that overflow the logical buffer. - `indirect_argument_span` (`list.rs:1692-1705`) requires only the final record's payload (`16`/`20`/`12` bytes) without trailing stride padding, matching what the clamp compute shader actually loads while `indirect::bound` still allocates `stride * records.max(1)` for D3D12 `ExecuteIndirect`. - `max == 0` returns early (`list.rs:1604`) without incrementing the dropped indirect counter, and all offset/span checks use checked `u64` arithmetic and 4-byte alignment checks (`list.rs:1714-1721`). ### Verification - `cargo xtask policy`: `191 files ok`. - `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` (default and `--all-features`): clean. - RTX 5090 + `VICTORY_D3D12_DEBUG=1`: `list:: resource:: indirect::` **29 passed, 0 failed** (1 ignored), plus `--ignored indirect_span_does_not_inherit_a_larger_native_shadow` **1/1 passed**. - WARP + `--features diagnostics` + `VICTORY_D3D12_DEBUG=1`: `list:: resource:: indirect::` **29 passed, 0 failed** (1 ignored), plus `--ignored indirect_span_does_not_inherit_a_larger_native_shadow` **1/1 passed**. - Additional boundary probe checking all five indirect kinds (`0`, `1`, `2`, `10`, `105`), unknown kind rejection, final-record-without-padding (`stride=32, payload=16, count=2 -> 48`), counted 4 GiB capping for strides 16/20/12, `< payload` counted rejection, uncounted `> 4 GiB` rejection, and `u64::MAX` / alignment edges in `indirect_offset`: passed.
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/1817:upstream-pr/1817'
git switch 'upstream-pr/1817'

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/1817'
git switch 'upstream-pr/1817'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1817'
git switch 'upstream-pr/1817'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1817'
git switch 'main'
git merge --squash 'upstream-pr/1817'
git switch 'main'
git merge --ff-only 'upstream-pr/1817'
git switch 'main'
git merge 'upstream-pr/1817'
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
Marvisak/VIctory!1815
No description provided.