Fix Windows 10 Game-Init crash and root-signature fallback #623

Closed
github-bot wants to merge 3 commits from gh-pr/623/head into gh-pr/623/base
Owner

@⁠bittertea0323 on GitHub · 2026-11-24 05:48 UTC · original
bittertea0323:fix/win10-init-and-rootsig → main · +76 −9 · 2 files · 3 commits · closed without merging

Fixes the title crashing at +0xb5a5f8 right after XUserAddAsync (issue #348) by implementing the XUser maximum-users slot, plus a token and a root-signature fallback. See #622 for reproduction and measurements.

**@⁠bittertea0323** on GitHub · 2026-11-24 05:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/623) `bittertea0323:fix/win10-init-and-rootsig` → `main` · +76 −9 · 2 files · 3 commits · closed without merging Fixes the title crashing at +0xb5a5f8 right after XUserAddAsync (issue #348) by implementing the XUser maximum-users slot, plus a token and a root-signature fallback. See #622 for reproduction and measurements.
- XUser maximum-users slot 0x30 now returns one user instead of E_NOTIMPL,
  which gets the title past Game Init into the render loop (issue #348).
- token_async reports S_OK with the empty token buffer instead of
  FAILED_TO_GET_TOKEN, matching resolve_privilege_async.
- The 1.1 root signature falls back to serialization without the
  CBV_SRV_UAV/SAMPLER_HEAP_DIRECTLY_INDEXED flags when Windows 10's
  d3d12core refuses them, instead of dropping every draw.
The refusal error E_INVALIDARG names nothing, so the field dump
(vs/ps sizes, RTV/DSV formats, samples, input count, cull/fill,
depth/blend, topology) is what shows whether a refusal is a
translation defect or a description defect. Seen in the field: it is
neither on this host - it is the SM 6.6 bindless OS boundary
documented in issue #622.
The token path is never reached during Game Init on the repro host (the
offline log line never fires before the +0xb5a5f8 fault), so the S_OK
change was unnecessary and it broke the pinned unit test. Keep the
failure status. Add the unit test for the maximum-users slot requested
in the review.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:10:27 +00:00
github-bot closed this pull request 2026-11-26 04:10:27 +00:00
Author
Owner

@⁠bittertea0323 on GitHub · 2026-11-24 06:17 UTC · original

Agility SDK plan for Windows 10 hosts posted on issue #622: the two mandatory exports, the loader-lock trap, the import-lib generation, and the one remaining Rust linking gap. This PR intentionally ships without the Agility bits.

**@⁠bittertea0323** on GitHub · 2026-11-24 06:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/623#issuecomment-7123786781) Agility SDK plan for Windows 10 hosts posted on issue #622: the two mandatory exports, the loader-lock trap, the import-lib generation, and the one remaining Rust linking gap. This PR intentionally ships without the Agility bits.
Author
Owner

@⁠bittertea0323 on GitHub · 2026-11-24 06:29 UTC · original

Thanks for the review — all three points addressed in 7c01e3d.

  1. token_async reverted to FAILED_TO_GET_TOKEN. You were right to flag it. On the repro host the token path is never reached during Game Init (the "token and signature: offline" log line never fires before the +0xb5a5f8 fault), so the S_OK change was speculative and it broke the pinned test. Reverted, test passes again.

  2. Unit test added for get_max_users (slot 0x30): asserts out == 1 and S_OK, in the same style as the existing slot tests. cargo test -p victory-hle modules::xuser is green.

  3. Root signature fallback vs #626: mine handles the D3D12SerializeVersionedRootSignature refusal (the "Unsupported bit-flag set" from Windows 10's d3d12core) and retries without the two 1.1 heap-indexing flags. If #626 additionally covers CreateRootSignature failure, the two are complementary, not conflicting — happy to drop my host.rs change entirely if #626 lands first and maintainers prefer one path.

**@⁠bittertea0323** on GitHub · 2026-11-24 06:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/623#issuecomment-7123985169) Thanks for the review — all three points addressed in 7c01e3d. 1. **token_async reverted to `FAILED_TO_GET_TOKEN`.** You were right to flag it. On the repro host the token path is never reached during Game Init (the "token and signature: offline" log line never fires before the `+0xb5a5f8` fault), so the S_OK change was speculative and it broke the pinned test. Reverted, test passes again. 2. **Unit test added for `get_max_users`** (slot 0x30): asserts `out == 1` and `S_OK`, in the same style as the existing slot tests. `cargo test -p victory-hle modules::xuser` is green. 3. **Root signature fallback vs #626:** mine handles the `D3D12SerializeVersionedRootSignature` refusal (the "Unsupported bit-flag set" from Windows 10's d3d12core) and retries without the two 1.1 heap-indexing flags. If #626 additionally covers `CreateRootSignature` failure, the two are complementary, not conflicting — happy to drop my host.rs change entirely if #626 lands first and maintainers prefer one path.
Author
Owner

@⁠Zilumz1 on GitHub · 2026-11-24 08:30 UTC · original

Tested 7c01e3d on Windows 10 Pro + AMD Radeon RX 580 2048SP (Polaris), driver 31.0.21925.1001, Rust 1.98.1, MSVC 14.44, in-box D3D12 runtime (no Agility SDK). No title run, only the synthetic checks below.

Tests: cargo test -p victory-hle -p victory-gpu --no-fail-fast -- --test-threads=1

  • victory-gpu: 43 passed, 0 failed, 1 ignored
  • victory-hle: 85 passed, 1 failed. The new get_max_users assertion passes inside startup_adds_the_user_and_reads_its_id. The one failure is net::tests::only_loopback_is_reachable (winhttp.dll lacks WinHttpGetProxySettingsEx). That's the Windows 10 net test fixed on main by #152, which isn't on this branch's base (d2a4bae), so it's unrelated to this PR. A rebase should clear it.

The root-signature error reproduces on this host. Empty 1.1 signature, D3D12SerializeVersionedRootSignature on the in-box runtime:

Flags Result
0x601 (input layout + both heap-indexing flags, as root_signature() builds it) 0x80070057 "Unsupported bit-flag set (root signature flags 601)."
0x001 (input layout only, the retry) S_OK

So the fallback does serialize where the original doesn't.

One question about the fallback. The translated shaders reach their descriptors through SM 6.6 ResourceDescriptorHeap[] / SamplerDescriptorHeap[] (createHandleFromHeap, emit/mod.rs:17-21). As I understand the D3D12 rules, a PSO whose shaders index the heaps needs a root signature with *_HEAP_DIRECTLY_INDEXED. So on a host where the retry kicks in, does pipeline creation then get refused instead, or do the menu's pipelines not use heap indexing? I haven't measured this, since I don't run the title. If they do, the Agility SDK route (#463 for victory.exe, #486 for the tests) would be the fix, and the retry would only move the failure into PSO creation. The extra fields in the host pipeline refused warning would show that either way.

The same flags are also set in crates/victory-shader/src/emit/host.rs:191, which this PR doesn't touch.

AI-assisted; the results above are real runs on my machine.

**@⁠Zilumz1** on GitHub · 2026-11-24 08:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/623#issuecomment-7126209625) Tested `7c01e3d` on **Windows 10 Pro + AMD Radeon RX 580 2048SP (Polaris), driver 31.0.21925.1001**, Rust 1.98.1, MSVC 14.44, in-box D3D12 runtime (no Agility SDK). No title run, only the synthetic checks below. **Tests:** `cargo test -p victory-hle -p victory-gpu --no-fail-fast -- --test-threads=1` - `victory-gpu`: 43 passed, 0 failed, 1 ignored - `victory-hle`: 85 passed, 1 failed. The new `get_max_users` assertion passes inside `startup_adds_the_user_and_reads_its_id`. The one failure is `net::tests::only_loopback_is_reachable` (`winhttp.dll lacks WinHttpGetProxySettingsEx`). That's the Windows 10 net test fixed on main by #152, which isn't on this branch's base (`d2a4bae`), so it's unrelated to this PR. A rebase should clear it. **The root-signature error reproduces on this host.** Empty 1.1 signature, `D3D12SerializeVersionedRootSignature` on the in-box runtime: | Flags | Result | |---|---| | `0x601` (input layout + both heap-indexing flags, as `root_signature()` builds it) | `0x80070057` "Unsupported bit-flag set (root signature flags 601)." | | `0x001` (input layout only, the retry) | `S_OK` | So the fallback does serialize where the original doesn't. **One question about the fallback.** The translated shaders reach their descriptors through SM 6.6 `ResourceDescriptorHeap[]` / `SamplerDescriptorHeap[]` (`createHandleFromHeap`, `emit/mod.rs:17-21`). As I understand the D3D12 rules, a PSO whose shaders index the heaps needs a root signature with `*_HEAP_DIRECTLY_INDEXED`. So on a host where the retry kicks in, does pipeline creation then get refused instead, or do the menu's pipelines not use heap indexing? I haven't measured this, since I don't run the title. If they do, the Agility SDK route (#463 for `victory.exe`, #486 for the tests) would be the fix, and the retry would only move the failure into PSO creation. The extra fields in the `host pipeline refused` warning would show that either way. The same flags are also set in `crates/victory-shader/src/emit/host.rs:191`, which this PR doesn't touch. AI-assisted; the results above are real runs on my machine.
Author
Owner

@⁠Zilumz1 on GitHub · 2026-11-24 08:36 UTC · original

Follow-up to my question above: measured, not guessed. Same machine (Windows 10 Pro, RX 580 / Polaris, driver 31.0.21925.1001), main at ba7d873.

I added a temporary test to emit/valu_tests.rs (not committed). It lowers a real synthetic GFX10 compute shader through the normal pipeline (build_valu_cs, a v_mov_b32 + raw UAV store, so the DXIL is cs_6_6 with createHandleFromHeap). Then it creates its root signature and compute PSO directly on the hardware device, once with the heap-indexing flags and once without (#623's fallback):

Runtime Highest SM With *_HEAP_DIRECTLY_INDEXED Without (#623 fallback)
In-box (Windows 10) 0x65 root signature refused, 0x80070057 root signature OK, PSO refused 0x80070057
Agility SDK 1.620.2 (#486 opt-in) 0x66 root signature OK, PSO OK root signature OK, PSO refused 0x80070057

So on Windows 10 the retry only moves the failure from root-signature serialization into PSO creation. The menu would still drop its draws, just with a "host pipeline refused" warning instead of a root-signature one. Even on a host that does have SM 6.6, the PSO without the flags is refused, because the shaders index the heaps.

What actually works on this machine is shader model 6.6 through the Agility runtime, with the flags kept: #463 for victory.exe, #486 for the tests.

Suggestion for #623: keep the get_max_users fix (the crash) and the extra host pipeline refused fields. Drop the root-signature retry, or have it log a clear "this host lacks SM 6.6 / the Agility runtime" error instead of retrying. I can share the probe test if useful.

AI-assisted; the results above are real runs on my machine.

**@⁠Zilumz1** on GitHub · 2026-11-24 08:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/623#issuecomment-7126350973) Follow-up to my question above: **measured, not guessed.** Same machine (Windows 10 Pro, RX 580 / Polaris, driver 31.0.21925.1001), `main` at `ba7d873`. I added a temporary test to `emit/valu_tests.rs` (not committed). It lowers a real synthetic GFX10 compute shader through the normal pipeline (`build_valu_cs`, a `v_mov_b32` + raw UAV store, so the DXIL is `cs_6_6` with `createHandleFromHeap`). Then it creates its root signature and compute PSO directly on the hardware device, once with the heap-indexing flags and once without (#623's fallback): | Runtime | Highest SM | With `*_HEAP_DIRECTLY_INDEXED` | Without (#623 fallback) | |---|---|---|---| | In-box (Windows 10) | `0x65` | root signature refused, `0x80070057` | root signature **OK**, PSO **refused** `0x80070057` | | Agility SDK 1.620.2 (#486 opt-in) | `0x66` | root signature OK, **PSO OK** | root signature OK, PSO **refused** `0x80070057` | So on Windows 10 the retry only moves the failure from root-signature serialization into PSO creation. The menu would still drop its draws, just with a "host pipeline refused" warning instead of a root-signature one. Even on a host that does have SM 6.6, the PSO without the flags is refused, because the shaders index the heaps. What actually works on this machine is shader model 6.6 through the Agility runtime, with the flags kept: #463 for `victory.exe`, #486 for the tests. Suggestion for #623: keep the `get_max_users` fix (the crash) and the extra `host pipeline refused` fields. Drop the root-signature retry, or have it log a clear "this host lacks SM 6.6 / the Agility runtime" error instead of retrying. I can share the probe test if useful. AI-assisted; the results above are real runs on my machine.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:26 UTC · original

Automated triage for the maintainers. Closing because another open pull request covers the same change.

See #626.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

**@⁠Marvisak** on GitHub · 2026-11-25 00:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/623#issuecomment-7148509305) Automated triage for the maintainers. Closing because another open pull request covers the same change. See #626. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!623
No description provided.