GPU: clear DXGI outputs on out-of-range enumeration #553

Merged
broccolize merged 1 commit from upstream-pr/553 into main 2026-11-25 00:20:12 +00:00
broccolize commented 2026-11-24 04:49:37 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by broccolize on 2026-11-24T04:49:37Z.


EnumAdapters, EnumAdapters1, and EnumOutputs now clear the caller’s output pointer when an index is out of range and return DXGI_ERROR_NOT_FOUND. I verified that native DXGI clears the pointer at the first missing index for all three methods.

The regression starts each output slot with a non-null pointer. It failed on main and passes with this change.

On Windows with Rust 1.98.1 (GNU), the GPU suite passed 44 tests by default and 46 with diagnostics. Both runs had zero failures and one ignored benchmark. The asset policy and git diff --check passed.

AI-assisted with Codex. The regression used synthetic objects.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6574852245 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/553). Originally posted by [broccolize](https://github.com/broccolize) on 2026-11-24T04:49:37Z. --- `EnumAdapters`, `EnumAdapters1`, and `EnumOutputs` now clear the caller’s output pointer when an index is out of range and return `DXGI_ERROR_NOT_FOUND`. I verified that native DXGI clears the pointer at the first missing index for all three methods. The regression starts each output slot with a non-null pointer. It failed on `main` and passes with this change. On Windows with Rust 1.98.1 (GNU), the GPU suite passed 44 tests by default and 46 with diagnostics. Both runs had zero failures and one ignored benchmark. The asset policy and `git diff --check` passed. AI-assisted with Codex. The regression used synthetic objects.
LAKSHYA-cmd-tech commented 2026-11-24 06:53:41 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by LAKSHYA-cmd-tech on 2026-11-24T04:55:08Z.

Review: APPROVED


Verified on Windows 11 D3D12:

  • Both DXGI tests pass, including the new \out_of_range_enumeration_clears_output\ regression test.
  • \enumeration_not_found\ correctly clears the output pointer before returning \DXGI_ERROR_NOT_FOUND, matching native DXGI behavior.
  • \cargo clippy -p victory-gpu\ clean, \cargo xtask policy\ passes.
<!-- greyfinch-sync:Marvisak/VIctory:review:6033859188 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/553#pullrequestreview-6033859188). Originally posted by [LAKSHYA-cmd-tech](https://github.com/LAKSHYA-cmd-tech) on 2026-11-24T04:55:08Z. **Review:** APPROVED --- Verified on Windows 11 D3D12: - Both DXGI tests pass, including the new \out_of_range_enumeration_clears_output\ regression test. - \enumeration_not_found\ correctly clears the output pointer before returning \DXGI_ERROR_NOT_FOUND\, matching native DXGI behavior. - \cargo clippy -p victory-gpu\ clean, \cargo xtask policy\ passes.
mercuryVM commented 2026-11-24 12:03:54 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T11:46:20Z.

Review: APPROVED


Tested b796c8b on Windows 11, RTX 5070, MSVC: cargo test -p victory-gpu -- --test-threads=1 44 passed, including out_of_range_enumeration_clears_output. Clippy's 1 warning is the existing one in host.rs.

  • Writing null to *out before returning DXGI_ERROR_NOT_FOUND matches native DXGI. Titles that loop EnumAdapters until NOT_FOUND and then release whatever *out holds no longer touch a stale pointer.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:review:6038612851 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/553#pullrequestreview-6038612851). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T11:46:20Z. **Review:** APPROVED --- Tested b796c8b on Windows 11, RTX 5070, MSVC: `cargo test -p victory-gpu -- --test-threads=1` 44 passed, including `out_of_range_enumeration_clears_output`. Clippy's 1 warning is the existing one in host.rs. - Writing null to `*out` before returning `DXGI_ERROR_NOT_FOUND` matches native DXGI. Titles that loop `EnumAdapters` until `NOT_FOUND` and then release whatever `*out` holds no longer touch a stale pointer. AI-assisted (Claude Code).
geiyiliyabumo commented 2026-11-24 13:01:59 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by geiyiliyabumo on 2026-11-24T12:13:21Z.


Independent verification & code review on Windows 11 Pro (build 26100) + AMD Radeon RX 9060 XT (RDNA4, driver 32.0.32029.2010, Rust 1.98.1), cleanly merged onto main (ffe310e):

  • cargo xtask policy: PASS (154 files ok)
  • cargo clippy -p victory-gpu --all-targets --locked -- -D warnings: PASS
  • cargo clippy -p victory-gpu --all-targets --features diagnostics --locked -- -D warnings: PASS
  • cargo test -p victory-gpu --locked: 51 passed, 0 failed, 1 ignored (including new dxgi::tests::out_of_range_enumeration_clears_output)

Diff review (crates/victory-gpu/src/dxgi.rs): clean, minimal, and matches COM/DXGI contract — zeroing non-null *out on DXGI_ERROR_NOT_FOUND prevents callers reusing a slot across loop iterations from seeing a stale pointer.

AI-assisted; synthetic tests only, no game files.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7131135748 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/553#issuecomment-7131135748). Originally posted by [geiyiliyabumo](https://github.com/geiyiliyabumo) on 2026-11-24T12:13:21Z. --- Independent verification & code review on Windows 11 Pro (build 26100) + AMD Radeon RX 9060 XT (RDNA4, driver `32.0.32029.2010`, Rust `1.98.1`), cleanly merged onto `main` (`ffe310e`): - `cargo xtask policy`: PASS (`154 files ok`) - `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings`: PASS - `cargo clippy -p victory-gpu --all-targets --features diagnostics --locked -- -D warnings`: PASS - `cargo test -p victory-gpu --locked`: **51 passed, 0 failed, 1 ignored** (including new `dxgi::tests::out_of_range_enumeration_clears_output`) Diff review (`crates/victory-gpu/src/dxgi.rs`): clean, minimal, and matches COM/DXGI contract — zeroing non-null `*out` on `DXGI_ERROR_NOT_FOUND` prevents callers reusing a slot across loop iterations from seeing a stale pointer. *AI-assisted; synthetic tests only, no game files.*
upstream-sync closed this pull request 2026-11-25 01:04:12 +00:00
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!553
No description provided.