GPU: reject mismatched command list allocators #2963

Open
andrewpozdnakov7-jpg wants to merge 1 commit from upstream-pr/2965 into main
andrewpozdnakov7-jpg commented 2026-11-26 01:44:23 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T01:44:23Z.


Command list creation and Reset now require an allocator of the same command list type. The shared list paths check the allocator before creating host state, marking a pipeline used, or restarting a list. The cross-queue regression now supplies a matching allocator for each of its graphics and compute lists.

Native inbox and app-local D3D12 WARP returned E_INVALIDARG for real list creation and for Reset with a mismatched DIRECT/COPY allocator, in both directions. A matching reset after the rejection returned S_OK. CreateCommandList, Reset.

The same synthetic guest-vtable fixture on main at 63bcca43 created a list and returned S_OK in every mismatch case. The patch matches the native results for both list types, including the matching creation and reset controls.

Five default list tests and the app-local WARP diagnostics suite passed (247 passed, one ignored), including the cross-queue fixture. Strict GPU Clippy in both feature configurations and asset policy passed.

AI-assisted. The paired comparison used software WARP and synthetic lists.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6617615588 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2965). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-26T01:44:23Z. --- Command list creation and Reset now require an allocator of the same command list type. The shared list paths check the allocator before creating host state, marking a pipeline used, or restarting a list. The cross-queue regression now supplies a matching allocator for each of its graphics and compute lists. Native inbox and app-local D3D12 WARP returned E_INVALIDARG for real list creation and for Reset with a mismatched DIRECT/COPY allocator, in both directions. A matching reset after the rejection returned S_OK. [CreateCommandList](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device-createcommandlist), [Reset](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist-reset). The same synthetic guest-vtable fixture on main at 63bcca43 created a list and returned S_OK in every mismatch case. The patch matches the native results for both list types, including the matching creation and reset controls. Five default list tests and the app-local WARP diagnostics suite passed (247 passed, one ignored), including the cross-queue fixture. Strict GPU Clippy in both feature configurations and asset policy passed. AI-assisted. The paired comparison used software WARP and synthetic lists.
fuzeofficlal commented 2026-11-26 02:06:46 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T01:54:54Z.

Review: COMMENTED


Reviewed and verified against main (63bcca43) on Windows 11 (RTX 5090 + WARP, VICTORY_D3D12_DEBUG=1) — clean fix and ready to merge:

  • Object::uses_table (crates/victory-gpu/src/object.rs:61-63) + allocator_kind (list.rs:319-327) safely verify the COM vtable before reading kind, and both new_list (list.rs:376) and reset (list.rs:468-473) reject mismatched allocator types with E_INVALIDARG (also fixing the mismatched direct allocator in resource.rs:3067-3131).
  • Minor non-blocking note: in list.rs:376, (!out.is_null() && allocator_kind(allocator) != Some(kind)) skips the allocator-type check when a caller passes out == null to probe creation (S_FALSE path in object.rs:136), whereas the adjacent allocator.is_null() check still runs for out == null. Dropping !out.is_null() && would make probe calls consistent.

Local verification:

  • cargo test --locked -p victory-gpu --lib list:: resource::tests::: 23/23 passed on both RTX 5090 and WARP (VICTORY_D3D12_DEBUG=1), including list_creation_and_reset_reject_the_wrong_allocator_type
  • cargo clippy --locked -p victory-gpu --tests -- -D warnings: 0 warnings
  • cargo xtask policy: 191 files ok
<!-- greyfinch-sync:Marvisak/VIctory:review:6067519255 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2965#pullrequestreview-6067519255). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T01:54:54Z. **Review:** COMMENTED --- Reviewed and verified against `main` (`63bcca43`) on Windows 11 (RTX 5090 + WARP, `VICTORY_D3D12_DEBUG=1`) — clean fix and ready to merge: - `Object::uses_table` (`crates/victory-gpu/src/object.rs:61-63`) + `allocator_kind` (`list.rs:319-327`) safely verify the COM vtable before reading `kind`, and both `new_list` (`list.rs:376`) and `reset` (`list.rs:468-473`) reject mismatched allocator types with `E_INVALIDARG` (also fixing the mismatched direct allocator in `resource.rs:3067-3131`). - **Minor non-blocking note**: in `list.rs:376`, `(!out.is_null() && allocator_kind(allocator) != Some(kind))` skips the allocator-type check when a caller passes `out == null` to probe creation (`S_FALSE` path in `object.rs:136`), whereas the adjacent `allocator.is_null()` check still runs for `out == null`. Dropping `!out.is_null() &&` would make probe calls consistent. **Local verification**: - `cargo test --locked -p victory-gpu --lib list:: resource::tests::`: **23/23 passed** on both RTX 5090 and WARP (`VICTORY_D3D12_DEBUG=1`), including `list_creation_and_reset_reject_the_wrong_allocator_type` - `cargo clippy --locked -p victory-gpu --tests -- -D warnings`: 0 warnings - `cargo xtask policy`: 191 files ok
andrewpozdnakov7-jpg commented 2026-11-26 02:07:16 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T01:59:34Z.


Thanks for the RTX 5090 and WARP checks. On both inbox WARP and Agility WARP, CreateCommandList with a null output returned E_UNEXPECTED with either allocator in both DIRECT/COPY directions. Real creates and Reset returned E_INVALIDARG for the mismatched type, and a subsequent matching Reset returned S_OK.

I kept VIctory's established S_FALSE probe behavior in 6f8a7e4. Removing the output guard would make the mismatched probe return E_INVALIDARG and the matching probe return S_FALSE, where both native runtimes reported the same status. The real-create and Reset paths are the ones covered by this fix.

Review note

<!-- greyfinch-sync:Marvisak/VIctory:comment:7180351004 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2965#issuecomment-7180351004). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-26T01:59:34Z. --- Thanks for the RTX 5090 and WARP checks. On both inbox WARP and Agility WARP, CreateCommandList with a null output returned E_UNEXPECTED with either allocator in both DIRECT/COPY directions. Real creates and Reset returned E_INVALIDARG for the mismatched type, and a subsequent matching Reset returned S_OK. I kept VIctory's established S_FALSE probe behavior in 6f8a7e4. Removing the output guard would make the mismatched probe return E_INVALIDARG and the matching probe return S_FALSE, where both native runtimes reported the same status. The real-create and Reset paths are the ones covered by this fix. [Review note](https://github.com/Marvisak/VIctory/pull/2965#pullrequestreview-6067519255)
kotekompotek commented 2026-11-26 03:04:43 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T02:25:22Z.

Review: COMMENTED


Verified: D3D12 requires the allocator type to match the list type on both CreateCommandList and Reset — previously a mismatched (or foreign COM) allocator was accepted and blindly cast to our Allocator layout. uses_table is the right guard for the foreign-object case. Test asserts E_INVALIDARG on create+reset for both kinds, and the resource.rs test now correctly gives each list its own kind-matched allocator.

<!-- greyfinch-sync:Marvisak/VIctory:review:6067738137 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2965#pullrequestreview-6067738137). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-26T02:25:22Z. **Review:** COMMENTED --- Verified: D3D12 requires the allocator type to match the list type on both CreateCommandList and Reset — previously a mismatched (or foreign COM) allocator was accepted and blindly cast to our Allocator layout. uses_table is the right guard for the foreign-object case. Test asserts E_INVALIDARG on create+reset for both kinds, and the resource.rs test now correctly gives each list its own kind-matched allocator.
Marvisak commented 2026-11-26 06:03:40 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T05:22:25Z.


Automated triage for the maintainers.

Proposed close. This makes new_list and reset in crates/victory-gpu/src/list.rs return E_INVALIDARG when the allocator's type differs from the list's (or the allocator isn't one of ours, via the new Object::uses_table). That is input validation on the title's calls: a correct title never passes a mismatched allocator, so it adds no capability, and the evidence is desktop D3D12 / WARP behaviour, not the console runtime, which this layer emulates. If the console runtime accepts a pairing desktop D3D12 rejects, this turns a working call into a failure; the cross-queue test in resource.rs that had to change (a compute list on a direct allocator) is the kind of pattern that would break. What would change the verdict: evidence that the title passes a mismatched allocator and that the console rejects it, or a title-visible bug this fixes.

CI: passing.

This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the triage: proposed close label.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7183427170 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2965#issuecomment-7183427170). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-26T05:22:25Z. --- <!-- victory-triage v1 head=6f8a7e437c6b32982a2f79ad01ed08e118f80f0f verdict=proposed-close at=2026-11-26T05:22:30Z --> Automated triage for the maintainers. **Proposed close.** This makes `new_list` and `reset` in `crates/victory-gpu/src/list.rs` return `E_INVALIDARG` when the allocator's type differs from the list's (or the allocator isn't one of ours, via the new `Object::uses_table`). That is input validation on the title's calls: a correct title never passes a mismatched allocator, so it adds no capability, and the evidence is desktop D3D12 / WARP behaviour, not the console runtime, which this layer emulates. If the console runtime accepts a pairing desktop D3D12 rejects, this turns a working call into a failure; the cross-queue test in `resource.rs` that had to change (a compute list on a direct allocator) is the kind of pattern that would break. What would change the verdict: evidence that the title passes a mismatched allocator and that the console rejects it, or a title-visible bug this fixes. CI: passing. This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the `triage: proposed close` label. --- _Generated by [Claude Code](https://claude.ai/code)_
cloph-dsp commented 2026-11-27 07:50:49 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-27T07:50:49Z.


Independent CPU-only verification of PR #2965 (GPU: reject mismatched command list allocators).

  • Windows, rustc/cargo 1.100.0/MSVC, per-worktree CARGO_TARGET_DIR (D:\Victory-Contrib\target-2965-verify), CARGO_BUILD_JOBS=2.
  • Head 6f8a7e437c6b32982a2f79ad01ed08e118f80f0f, base 63bcca43c6a00a758510398fa43096ce7e4f7df0.
  • Command: cargo test --locked -p victory-gpu --lib -- list::tests::list_creation_and_reset_reject_the_wrong_allocator_type --exact --test-threads=1 --quiet -> 1 passed; 0 failed; 232 filtered.
  • Negative control: git grep -F for the new test name on 63bcca4 returned no hits (test absent on base).
  • git diff --check 63bcca4 HEAD exit 0 (clean).
  • Only the named synthetic test with the fake device::DEVICE was replayed; real D3D12 allocators and the full suite were not exercised.
  • AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only synthetic test). No game data, assets, shaders, DRM or decrypt used.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7212876765 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2965#issuecomment-7212876765). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-11-27T07:50:49Z. --- Independent CPU-only verification of PR #2965 (`GPU: reject mismatched command list allocators`). - Windows, rustc/cargo 1.100.0/MSVC, per-worktree `CARGO_TARGET_DIR` (`D:\Victory-Contrib\target-2965-verify`), `CARGO_BUILD_JOBS=2`. - Head `6f8a7e437c6b32982a2f79ad01ed08e118f80f0f`, base `63bcca43c6a00a758510398fa43096ce7e4f7df0`. - Command: `cargo test --locked -p victory-gpu --lib -- list::tests::list_creation_and_reset_reject_the_wrong_allocator_type --exact --test-threads=1 --quiet` -> `1 passed; 0 failed; 232 filtered`. - Negative control: `git grep -F` for the new test name on `63bcca4` returned no hits (test absent on base). - `git diff --check 63bcca4 HEAD` exit 0 (clean). - Only the named synthetic test with the fake `device::DEVICE` was replayed; real D3D12 allocators and the full suite were not exercised. - AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only synthetic test). No game data, assets, shaders, DRM or decrypt used.
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/2965:upstream-pr/2965'
git switch 'upstream-pr/2965'

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