GPU: reject unknown shader model feature requests #2945

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

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


CheckFeatureSupport(D3D12_FEATURE_SHADER_MODEL) was treating any integer as a version and returning success. D3D12 applications use E_INVALIDARG on an unknown request to try an older model. This change rejects undefined model requests before writing the result. Requests for the defined models 5.1 and 6.0 through 6.10 report up to the guest's SM 6.6 ceiling. Microsoft D3D12 contract, DirectX-Headers enum at 61c7718.

Validation

  • Native Windows FL 11_0 WARP with inbox D3D12 and with app-local Agility 1.620.2 both return E_INVALIDARG and retain the input for the seven invalid values in the test. The app-local runtime accepts a 6.10 request and reports its supported 6.9.

  • The same VIctory device-vtable fixture on main at 63bcca43 reports S_OK for the zero/no-model request. The updated result is E_INVALIDARG with the original field value for all seven invalid requests. All 12 defined requests get the expected model at or below SM 6.6.

  • Nine device tests and the full app-local WARP GPU diagnostics suite passed (247 passed, one ignored). Strict GPU Clippy in both feature configurations and the asset policy passed.

AI-assisted. Verification used synthetic inputs on software WARP.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6617266171 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2947). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-26T01:16:14Z. --- CheckFeatureSupport(D3D12_FEATURE_SHADER_MODEL) was treating any integer as a version and returning success. D3D12 applications use E_INVALIDARG on an unknown request to try an older model. This change rejects undefined model requests before writing the result. Requests for the defined models 5.1 and 6.0 through 6.10 report up to the guest's SM 6.6 ceiling. [Microsoft D3D12 contract](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ns-d3d12-d3d12_feature_data_shader_model), [DirectX-Headers enum at 61c7718](https://github.com/microsoft/DirectX-Headers/blob/61c7718954ec73dbdd43c723240fe1a0452a3724/include/directx/d3d12.h#L2863-L2880). **Validation** - Native Windows FL 11_0 WARP with inbox D3D12 and with app-local Agility 1.620.2 both return E_INVALIDARG and retain the input for the seven invalid values in the test. The app-local runtime accepts a 6.10 request and reports its supported 6.9. - The same VIctory device-vtable fixture on main at 63bcca43 reports S_OK for the zero/no-model request. The updated result is E_INVALIDARG with the original field value for all seven invalid requests. All 12 defined requests get the expected model at or below SM 6.6. - Nine device tests and the full app-local WARP GPU diagnostics suite passed (247 passed, one ignored). Strict GPU Clippy in both feature configurations and the asset policy passed. AI-assisted. Verification used synthetic inputs on software WARP.
Dukestar69 commented 2026-11-26 02:06:38 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T02:04:45Z.

Review: APPROVED


Tested merged onto origin/main (63bcca4) on Windows 11 x64:

  • cargo test -p victory-gpu --lib device::tests: 9 passed, 0 failed (including new shader_model_query_rejects_unknown_requests_without_writing verifying E_INVALIDARG without mutating the output for unknown values and clamping known SM 5.1 / 6.0–6.10 to 6.6).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6067586679 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2947#pullrequestreview-6067586679). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T02:04:45Z. **Review:** APPROVED --- Tested merged onto `origin/main` (`63bcca4`) on Windows 11 x64: - `cargo test -p victory-gpu --lib device::tests`: **9 passed, 0 failed** (including new `shader_model_query_rejects_unknown_requests_without_writing` verifying `E_INVALIDARG` without mutating the output for unknown values and clamping known SM 5.1 / 6.0–6.10 to 6.6). - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
fuzeofficlal commented 2026-11-26 02:07:10 +00:00 (Migrated from github.com)

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


Code review and RTX 5090 + WARP verification at head 1735e200d1a3 on main (63bcca43c6a0):

  • Code review (crates/victory-gpu/src/device.rs:329-339):
    • Preserves null-pointer and size != 4 E_INVALIDARG checks, rejects undefined shader-model values outside 0x51 | 0x60..=0x6a with E_INVALIDARG without mutating *q, and clamps valid requests to (*q).min(0x66) (S_OK), matching native D3D12 CheckFeatureSupport(SHADER_MODEL).
  • Verified (Windows 11, NVIDIA RTX 5090 + WARP, VICTORY_D3D12_DEBUG=1, Rust 1.98.1):
    • cargo xtask policy: 191 files ok; cargo clippy --locked -p victory-gpu --tests -- -D warnings: 0 warnings
    • victory-gpu -- device::tests: 9/9 passed on both RTX 5090 and WARP.

LGTM.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7179865386 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2947#issuecomment-7179865386). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T01:31:57Z. --- Code review and RTX 5090 + WARP verification at head `1735e200d1a3` on `main` (`63bcca43c6a0`): - **Code review (`crates/victory-gpu/src/device.rs:329-339`)**: - Preserves null-pointer and `size != 4` `E_INVALIDARG` checks, rejects undefined shader-model values outside `0x51 | 0x60..=0x6a` with `E_INVALIDARG` without mutating `*q`, and clamps valid requests to `(*q).min(0x66)` (`S_OK`), matching native D3D12 `CheckFeatureSupport(SHADER_MODEL)`. - **Verified (Windows 11, NVIDIA RTX 5090 + WARP, `VICTORY_D3D12_DEBUG=1`, Rust 1.98.1)**: - `cargo xtask policy`: `191 files ok`; `cargo clippy --locked -p victory-gpu --tests -- -D warnings`: 0 warnings - `victory-gpu -- device::tests`: **9/9 passed** on both RTX 5090 and WARP. LGTM.
kotekompotek commented 2026-11-26 03:04:36 +00:00 (Migrated from github.com)

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

Review: COMMENTED


Verified: CheckFeatureSupport(SHADER_MODEL) is supposed to E_INVALIDARG non-enum input before the clamp — accepting 0x51 and 0x60..=0x6a covers SM 5.1 through 6.10, and the validation now happens before the min(0x66) so unknown inputs keep their value untouched. The test pins both halves (reject-without-write, accept-and-clamp) — non-tautological.

<!-- greyfinch-sync:Marvisak/VIctory:review:6067690534 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2947#pullrequestreview-6067690534). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-26T02:19:06Z. **Review:** COMMENTED --- Verified: CheckFeatureSupport(SHADER_MODEL) is supposed to E_INVALIDARG non-enum input before the clamp — accepting 0x51 and 0x60..=0x6a covers SM 5.1 through 6.10, and the validation now happens before the min(0x66) so unknown inputs keep their value untouched. The test pins both halves (reject-without-write, accept-and-clamp) — non-tautological.
Marvisak commented 2026-11-26 05:04:11 +00:00 (Migrated from github.com)

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


Automated triage for the maintainers.

Needs work. check_feature_support for SHADER_MODEL (victory-gpu/src/device.rs) would return E_INVALIDARG for values other than 5.1 and 6.0 through 6.10. The evidence is the desktop runtime on WARP, but this device stands in for the console's runtime, and nothing shows the title or its upscaler sends an undefined value. Please show that the title can send such a request, or give a reference for how the console runtime answers; otherwise this guards a case that does not occur and adds a hard upper bound (0x6a) nothing needs.

CI: passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7182635178 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2947#issuecomment-7182635178). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-26T04:29:06Z. --- <!-- victory-triage v1 head=1735e200d1a36a9657b6dec677a5d1cc42d1e113 verdict=needs-work at=2026-11-26T04:29:00Z --> Automated triage for the maintainers. **Needs work.** `check_feature_support` for SHADER_MODEL (`victory-gpu/src/device.rs`) would return E_INVALIDARG for values other than 5.1 and 6.0 through 6.10. The evidence is the desktop runtime on WARP, but this device stands in for the console's runtime, and nothing shows the title or its upscaler sends an undefined value. Please show that the title can send such a request, or give a reference for how the console runtime answers; otherwise this guards a case that does not occur and adds a hard upper bound (0x6a) nothing needs. 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/2947:upstream-pr/2947'
git switch 'upstream-pr/2947'

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