GPU: match failed feature-level query results #2929

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

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T00:26:50Z.


Summary

Match the D3D12_FEATURE_FEATURE_LEVELS failure results. An empty list returns E_INVALIDARG and leaves MaxSupportedFeatureLevel untouched. A nonempty list with no supported level returns DXGI_ERROR_UNSUPPORTED and writes zero. A successful query still reports the highest requested level within the console's 12_2 ceiling.

Verification

  • On native Windows D3D12 WARP at feature level 11_0, an empty request leaves the sentinel 0x1234. Requests [0] and [0xd000] return DXGI_ERROR_UNSUPPORTED and write zero. A valid mixed request succeeds; [0xb000, 0xb123] returns 0xb123.
  • The same synthetic device-vtable fixture on 63bcca4 observes the wrong empty-list status, a stale output above the ceiling, and success for [0]. It passes all three cases with this change and preserves the success and wrong-size controls. The query structure is documented in Microsoft's feature-level API reference.
  • Eight default device tests and the full app-local WARP GPU suite (246 passed, 1 ignored) pass. Strict GPU Clippy passes in default and all-features configurations.
  • Staged asset policy passed (191 files).
<!-- greyfinch-sync:Marvisak/VIctory:issue:6616652249 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2931). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-26T00:26:50Z. --- ### Summary Match the `D3D12_FEATURE_FEATURE_LEVELS` failure results. An empty list returns `E_INVALIDARG` and leaves `MaxSupportedFeatureLevel` untouched. A nonempty list with no supported level returns `DXGI_ERROR_UNSUPPORTED` and writes zero. A successful query still reports the highest requested level within the console's 12_2 ceiling. ### Verification - On native Windows D3D12 WARP at feature level 11_0, an empty request leaves the sentinel `0x1234`. Requests `[0]` and `[0xd000]` return `DXGI_ERROR_UNSUPPORTED` and write zero. A valid mixed request succeeds; `[0xb000, 0xb123]` returns `0xb123`. - The same synthetic device-vtable fixture on `63bcca4` observes the wrong empty-list status, a stale output above the ceiling, and success for `[0]`. It passes all three cases with this change and preserves the success and wrong-size controls. The query structure is documented in [Microsoft's feature-level API reference](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ns-d3d12-d3d12_feature_data_feature_levels). - Eight default device tests and the full app-local WARP GPU suite (246 passed, 1 ignored) pass. Strict GPU Clippy passes in default and all-features configurations. - Staged asset policy passed (191 files).
kotekompotek commented 2026-11-26 01:03:50 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T00:29:36Z.

Review: COMMENTED


Verified: count==0 is now rejected alongside null (matching D3D12's E_INVALIDARG for an empty level list), and highest is written unconditionally — 0 on failure — so a caller can't mistake a stale value for a result. The UNTOUCHED sentinel test pins the write-on-failure contract. LGTM.

<!-- greyfinch-sync:Marvisak/VIctory:review:6066919149 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2931#pullrequestreview-6066919149). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-26T00:29:36Z. **Review:** COMMENTED --- Verified: count==0 is now rejected alongside null (matching D3D12's E_INVALIDARG for an empty level list), and `highest` is written unconditionally — 0 on failure — so a caller can't mistake a stale value for a result. The UNTOUCHED sentinel test pins the write-on-failure contract. LGTM.
fuzeofficlal commented 2026-11-26 01:04:11 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T00:42:43Z.


Code review and RTX 5090 + WARP verification at head e15a3d35b560 merged cleanly onto main (63bcca43c6a0):

  • Code review (crates/victory-gpu/src/device.rs:354-373): Returns E_INVALIDARG early without mutating query.highest when query.count == 0 || query.requested.is_null(); otherwise writes the highest requested level <= HIGHEST_FEATURE_LEVEL (0xc200, or 0 if none qualify) and returns DXGI_ERROR_UNSUPPORTED (0x887A0004) when query.highest == 0 (covering both all-above-max like [0xd000] and all-zero [0]), matching native D3D12 CheckFeatureSupport(FEATURE_LEVELS).
  • Verified (Windows 11, NVIDIA RTX 5090 + WARP, VICTORY_D3D12_DEBUG=1, Rust 1.98.1):
    • cargo clippy -p victory-gpu --all-targets --locked -- -D warnings (default + --features diagnostics): 0 warnings; cargo test -p xtask --locked: 6/6 passed
    • device::tests: 8/8 passed on both RTX 5090 and WARP
    • descriptor::host::tests + host::tests + pipeline::host::tests: 31/31 passed on WARP; 30/31 on RTX 5090 (only pre-existing NVIDIA 1M heap-cap baseline dynamic_slots_are_held_until_released)
    • Single-threaded WARP victory-gpu --lib --features diagnostics (skipping present_plane_tests): 245/245 passed, 1 ignored.

Clean and accurate; LGTM.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7179037676 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2931#issuecomment-7179037676). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T00:42:43Z. --- Code review and RTX 5090 + WARP verification at head `e15a3d35b560` merged cleanly onto `main` (`63bcca43c6a0`): - **Code review (`crates/victory-gpu/src/device.rs:354-373`)**: Returns `E_INVALIDARG` early without mutating `query.highest` when `query.count == 0 || query.requested.is_null()`; otherwise writes the highest requested level `<= HIGHEST_FEATURE_LEVEL` (`0xc200`, or `0` if none qualify) and returns `DXGI_ERROR_UNSUPPORTED` (`0x887A0004`) when `query.highest == 0` (covering both all-above-max like `[0xd000]` and all-zero `[0]`), matching native D3D12 `CheckFeatureSupport(FEATURE_LEVELS)`. - **Verified (Windows 11, NVIDIA RTX 5090 + WARP, `VICTORY_D3D12_DEBUG=1`, Rust 1.98.1)**: - `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings` (default + `--features diagnostics`): 0 warnings; `cargo test -p xtask --locked`: 6/6 passed - `device::tests`: 8/8 passed on both RTX 5090 and WARP - `descriptor::host::tests` + `host::tests` + `pipeline::host::tests`: 31/31 passed on WARP; 30/31 on RTX 5090 (only pre-existing NVIDIA 1M heap-cap baseline `dynamic_slots_are_held_until_released`) - Single-threaded WARP `victory-gpu --lib --features diagnostics` (skipping `present_plane_tests`): 245/245 passed, 1 ignored. Clean and accurate; LGTM.
Marvisak commented 2026-11-26 05:04:09 +00:00 (Migrated from github.com)

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


Automated triage for the maintainers.

Needs work. feature_levels in victory-gpu/src/device.rs now returns E_INVALIDARG for an empty request and DXGI_ERROR_UNSUPPORTED (writing 0) when no level is supported. That matches the desktop WARP behaviour measured, but these are the console runtime's return values, and nothing shows the title ever sends such a request, so as it stands this guards paths the title may never reach. Please point to a title call that hits one of these paths, or to the console runtime's documented behaviour, and stop asserting acceptance of non-level values such as 0xb123 unless that is shown.

CI: passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7182585009 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2931#issuecomment-7182585009). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-26T04:25:37Z. --- <!-- victory-triage v1 head=e15a3d35b56025c64f061f2c7a66da9065b5784a verdict=needs-work at=2026-11-26T04:25:32Z --> Automated triage for the maintainers. **Needs work.** `feature_levels` in `victory-gpu/src/device.rs` now returns `E_INVALIDARG` for an empty request and `DXGI_ERROR_UNSUPPORTED` (writing 0) when no level is supported. That matches the desktop WARP behaviour measured, but these are the console runtime's return values, and nothing shows the title ever sends such a request, so as it stands this guards paths the title may never reach. Please point to a title call that hits one of these paths, or to the console runtime's documented behaviour, and stop asserting acceptance of non-level values such as `0xb123` unless that is shown. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
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/2931:upstream-pr/2931'
git switch 'upstream-pr/2931'

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