Skip to content

GPU: fall back to standard root signature flags when host runtime rejects 0xC01/0xC00 - #626

Open
LAKSHYA-cmd-tech wants to merge 1 commit into
Marvisak:mainfrom
LAKSHYA-cmd-tech:fix/root-signature-flags-fallback
Open

LAKSHYA-cmd-tech wants to merge 1 commit into
Marvisak:mainfrom
LAKSHYA-cmd-tech:fix/root-signature-flags-fallback

Conversation

@LAKSHYA-cmd-tech

Copy link
Copy Markdown

Summary

Fixes #598.

On Windows 10 in-box D3D12 runtimes or environments without Agility SDK / SM 6.6 root signature 1.2+ support, the serializer rejects Root Signature 1.1 with directly indexed descriptor heap flags (0xC01 / 0xC00):

root signature: Unsupported bit-flag set (root signature flags c01)
host root signature refused error=The parameter is incorrect. (0x80070057)

When root signature creation failed, pipeline compilation was rejected (None), resulting in unhandled null pointer dereferences (0xc0000005 (read 0x68)) during subsequent draw/dispatch invocations.

Solution

  • When D3D12SerializeVersionedRootSignature or device.CreateRootSignature rejects the combined flags (ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT | CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED | SAMPLER_HEAP_DIRECTLY_INDEXED), gracefully fall back to standard root signature flags (ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT for graphics, NONE for compute).
  • Added unit test pipeline::host::tests::host_root_signature_serializes_and_creates.

Verification

  • cargo test -p victory-gpu -- --test-threads=1: 44 passed, 0 failed, 1 ignored.
  • cargo clippy -p victory-gpu --lib -- -D warnings: 0 warnings.
  • cargo run -p xtask -- policy: 151 files clean.

@fromthemoonx

Copy link
Copy Markdown

Tested 772d294 (on main d2a4bae), plus one check on what the fallback root signature can host.

Environment: Windows 11 Pro build 26300, AMD Ryzen 7 5700X, 16 GB, NVIDIA GeForce RTX 3060 12 GB (driver 610.88), Rust 1.98.1 x86_64-pc-windows-msvc, debug.

Tested

  • cargo test --locked -p victory-gpu --lib: 44 passed, 0 failed, 1 ignored, including host_root_signature_serializes_and_creates. On this runtime the full flags are accepted, so the test only takes the first path; the fallback is never exercised here.
  • cargo test --locked --workspace: 265 passed, 0 failed, 4 ignored
  • cargo xtask policy: 151 files ok; clippy shows only main's host.rs:267 warning

Can the fallback root signature run a translated shader? Translated shaders reach their resources through createHandleFromHeap (victory-shader emit/shader.rs, heap_handle). That needs CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED / SAMPLER_HEAP_DIRECTLY_INDEXED on the root signature. To check, I gave victory-shader's test host (emit/host.rs, which builds its root signature with the same flags) the fallback's flags, i.e. ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT only, locally:

cargo test -p victory-shader emit:: result
full flags (as on main) 23 passed
fallback flags 16 passed, 7 failed: every GPU-run test, hardware: compute_pipeline failed: The parameter is incorrect.

So on this GPU, a pipeline built on the fallback root signature is refused at CreateComputePipelineState instead of at the root signature. It doesn't run. createHandleFromHeap is also SM 6.6, which the README lists as a requirement, so a runtime that rejects these flags probably can't take the translated shaders either way.

If the 0xc0000005 (read 0x68) in #598 is a draw or dispatch going ahead with no host pipeline, the fix may belong where a missing pipeline is handled; a refused pipeline would still crash it through this path. Do you have the stack of that crash from crashes.log?

Smaller notes:

  • More than half the diff is rustfmt reflow of code the PR doesn't otherwise change (GraphicsState input layout, mesh_pipeline's stream, code_bytes, the mesh refusal). Dropping that would make the change easier to review and conflict less with the other open PRs in pipeline/host.rs.
  • When serialization falls back, the original error text is no longer logged, so a log won't show that the fallback was taken.

Not tested: a Windows 10 in-box runtime that rejects the flags (not available here); no game data used.

AI-assisted (Claude Code) ran the checks and drafted this comment.

@LAKSHYA-cmd-tech
LAKSHYA-cmd-tech force-pushed the fix/root-signature-flags-fallback branch from 772d294 to ac114f1 Compare November 24, 2026 06:12
@LAKSHYA-cmd-tech

Copy link
Copy Markdown
Author

Thanks @fromthemoonx for the detailed testing and review!

Updated in commit ac114f1:

  1. Clean minimal diff: Removed all unrelated rustfmt reflows (GraphicsState, mesh_pipeline, code_bytes). The diff now strictly touches
    oot_signature and adds the synthetic unit test host_root_signature_serializes_and_creates.
  2. Preserved warning on fallback: The original serialization rejection message is now logged with racing::warn!("root signature: runtime rejected directly-indexed flags ({}), retrying without them", ...) before the retry so runtime logs clearly show the rejection and fallback.

Regarding the �xc0000005 (read 0x68) at +0xb5a5f8 in #598:
Cross-referencing with the site map in #630 and reproduction in #622, +0xb5a5f8 is actually the title's auth subsystem uninitialized object read immediately following XUserAddAsync (caused by missing slot 0x30 GetMaxUsers in xuser.rs), rather than a GPU pipeline crash (addressed separately in #648).

Regarding translated compute shaders: as you observed, shaders relying on createHandleFromHeap strictly require SM 6.6 heap indexing flags. This fallback specifically benefits root signatures and graphics/menu pipelines using standard root parameters/views on runtimes or compatibility layers where in-box d3d12core rejects 0xC01.

@fromthemoonx

Copy link
Copy Markdown

Thanks, and for tracing #598's crash to the auth path; that settles my question.

You're right about which shaders the fallback helps. In lower.rs handle(), only descriptors loaded from a table (Source::Loaded, and Phis of those) go through heap_handle. Root CBVs and SRVs (root_cbv_handle / root_srv_handle), constant samplers (static samplers) and root constants don't. So a pipeline that reads only those doesn't need the heap flags, and the fallback lets it through.

Re-tested ac114f1 (same RTX 3060 machine):

  • the diff is now only root_signature and the test; the fallback logs the rejection before retrying
  • cargo test --locked -p victory-gpu --lib: 44 passed, 0 failed, 1 ignored; cargo test --locked --workspace: 265 passed, 0 failed, 4 ignored; cargo xtask policy: ok
  • one nit: cargo fmt --check wants the new test's let Some(host) = crate::host::host() else { return }; split over three lines (the other fmt and clippy output in this file is already on main)

AI-assisted (Claude Code).

@Sharktooth12

Sharktooth12 commented Nov 24, 2026 •

Copy link
Copy Markdown

Tested this PR on Windows 10 22H2 (19045.6466), GTX 1650, driver 32.0.15.9186.
Fresh clone, checked out pr-626, cargo build --release, then ran the title with --execute.

The fallback triggers, but the game still doesn't get a working host pipeline:

WARN victory_gpu::pipeline::host: root signature: runtime rejected directly-indexed flags
(Unsupported bit-flag set (root signature flags c01).), retrying without them
WARN victory_gpu::pipeline::host: host pipeline refused error=The parameter is incorrect. (0x80070057)
shaders=[vertex dfafaf385b2f94e8, pixel 06295fb1d1aefb78]
(repeats for each pipeline)

victory_gpu::host: 19.8 fps, ... 0 draws/frame, dropped 3 without a host pipeline

Then it crashes about 6 seconds in:
VIctory: unhandled exception 0xc0000005 at victory-image-b99f876b74d4a77f.dll+0xb5a5f8 (read 0x68)

Same crash address as before the PR. Same result with VICTORY_D3D12_WARP=1,
--console series-s and --unimplemented zero.

My guess (haven't read the shader emitter): the translated shaders use directly
indexed heaps, so a root signature without those flags can't be paired with them
and pipeline creation fails. The failed pipeline is also still dereferenced later.

Happy to test more builds or a debug log if that helps.

Cause (confirmed in the source): the shader emitter indexes the descriptor heaps
directly. crates/victory-shader/src/emit/mod.rs (lines 17-21) documents SM 6.6
ResourceDescriptorHeap[] / SamplerDescriptorHeap[] and says the root signature
needs CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED and SAMPLER_HEAP_DIRECTLY_INDEXED, and
emit/shader.rs:285 emits createHandleFromHeap.

So on a runtime that rejects those flags (stock Windows 10 without the Agility SDK),
dropping them only moves the failure: root signature creation succeeds, but
CreateGraphicsPipelineState then fails with 0x80070057 because the shaders
need heap indexing. The failed pipeline is then still dereferenced later, which
causes the 0xc0000005 crash.

Possible directions: ship/load the Agility SDK so the runtime accepts SM 6.6 root
signature flags, or emit a table-based fallback when the host lacks support. In
either case a refused pipeline probably shouldn't lead to a crash later.

@Sharktooth12

Copy link
Copy Markdown

Follow-up test on Windows 10 22H2 (19045.6466), GTX 1650.

With this PR alone, pipelines were still refused (0x80070057), because the translated
shaders need the directly-indexed heap flags (emit/mod.rs lines 17-21).

I then made victory.exe opt in to the DirectX 12 Agility SDK:

  • build.rs with /EXPORT:D3D12SDKVersion,DATA and /EXPORT:D3D12SDKPath,DATA
  • exported D3D12SDKVersion = and D3D12SDKPath = ".\D3D12" from main.rs
  • Microsoft's D3D12Core.dll (package Microsoft.Direct3D.D3D12 ) in target\release\D3D12\

Result: the "runtime rejected directly-indexed flags" warning is gone, pipelines are
created, and the game now gets as far as the account/sign-in screen.
It then fails with: <PASTE THE LAST ERROR LINE(S) HERE>

So on Windows 10 this PR's fallback is not needed if the app ships the Agility SDK;
the full flags work. Redacted log attached. Happy to open a PR with the exports if you want it.

Expirimental:

powershell -ExecutionPolicy Bypass -File .\agility-test.ps1 -Game "game.exe location"

agility-test-change-to-dot-ps1.txt.txt

@LAKSHYA-cmd-tech
LAKSHYA-cmd-tech force-pushed the fix/root-signature-flags-fallback branch from ac114f1 to f8310d0 Compare November 24, 2026 08:13
@LAKSHYA-cmd-tech
LAKSHYA-cmd-tech force-pushed the fix/root-signature-flags-fallback branch from f8310d0 to df9ab3c Compare November 24, 2026 08:37
@DeerSilver

Copy link
Copy Markdown

Tested head df9ab3c merged onto main ffe310e (clean merge) on NVIDIA GeForce RTX 5060 Laptop GPU (Blackwell), driver 621.24, Windows 11 26300, Rust 1.98.1: pass. No game files: the test suite only.

  • The PR's new test passes. It uses the host GPU and ran on the RTX 5060 (DXGI adapter 0 on this laptop, so the host-device helpers return a device and the tests don't take their early return):
    • host_root_signature_serializes_and_creates
  • cargo test --workspace --locked: 343 passed, 0 failed, 6 ignored, against 342 passed / 6 ignored on main.
  • cargo clippy --workspace --all-targets --locked -- -D warnings: clean.

AI-assisted (Claude Code).

@nopsled0x

Copy link
Copy Markdown

I tried this on Windows 10 22H2 (build 19045), release build, GPU driver 621.40. The PR's one commit (df9ab3c) is cherry-picked on top of current main (ffe310e), because the PR branch is based on 58fed37. Running the title with run ... --execute:

  • The host root signature refused warning no longer appears (0 occurrences). The retry without the directly-indexed flags is used instead: 236 runtime rejected directly-indexed flags warnings (228 with c00, 8 with c01).
  • Host pipeline creation is then refused instead, with the same 0x80070057: 236 host pipeline refused warnings, 8 of them for vertex+pixel pipelines (for example vertex dfafaf385b2f94e8, pixel 06295fb1d1aefb78) and 228 for compute shaders. The host pipeline library is also rejected once with the same error.
  • The last frame presented is frame 32, with draws=48 drawn=0 dispatches=0.
  • The title still stops with 0xc0000005 (read at 0x68) at victory-image-b99f876b74d4a77f.dll+0xb5a5f8, right after XUserAddAsync, exit code -1073741819. Without the PR, ffe310e stops at the same address; I saw the same on 8e79c80 in an earlier run, but I no longer have that log.

My reading, which is a hypothesis and not something I confirmed: the shaders need the directly-indexed flags, so a root signature without them is accepted but the pipelines that use it are refused, and the title still ends up with a null object. That would mean the PR removes the root signature refusal but not the cause of the crash on this setup. I did not check what the title does at +0xb5a5f8.

Not verified: the PR's test (host_root_signature_serializes_and_creates), cargo clippy, cargo test --workspace, Windows 11 or an Agility SDK runtime, and a second GPU or driver. The crash at this address is also described in #998, #789 and #741.

AI-assisted verification (Claude); the game was run locally by me.

yourmomsbasement pushed a commit to yourmomsbasement/VIctory_Dev that referenced this pull request Nov 24, 2026
…ied together

Merges Marvisak#72 Marvisak#347 Marvisak#1000 Marvisak#358 Marvisak#352 Marvisak#626 Marvisak#1152 Marvisak#1129 Marvisak#1203 Marvisak#24 Marvisak#642 Marvisak#427 Marvisak#485
Marvisak#550 Marvisak#174 Marvisak#1279 onto main (ffe310e), each head unchanged, no conflicts.

One change of mine: three of the PRs each add a `mod tests` at the end of
pipeline/host.rs, so the merge defines `tests` three times (E0428). The
second and third are named `library_tests` and `blend_tests`; nothing else
changes.

cargo clippy --workspace --all-targets --locked -- -D warnings, with and
without --all-features, is clean and cargo test --workspace --locked passes
(367 passed, 6 ignored; main has 342 passed, 6 ignored).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
edsuuu referenced this pull request in edsuuu/VI-BR-PORT Nov 24, 2026
…ame wait bundle

Taken from the bundle: 64 MB stacks for pipeline workers (#1129), no
blending on integer render targets (#1152), root signature flag fallback
(#626), read-only depth read states (#485, on our stored rtvs/dsv and
bind_targets), enhanced texture barrier translation (#642, on our
recording_list so continuation segments get it), indirect mesh dispatch
(#24), the frame wait taking its tick before it sleeps (#174), and the
make.rs unit tests (#1203).

Kept from our side:
- pipeline/make.rs: early() starts every compute pipeline at creation
  (b4e8419); the per-pipeline wake pair, per-frame budget, wait_compute
  and copystat counters. The bundle's the_wait_budget_is_spent_once_per_frame
  test is dropped (written for its fixed BUDGET; our FrameBudget tests
  cover it); a_pipeline_is_made_once now holds the tests' serial lock.
- indirect.rs: our whole file (#40's overflow-safe clamp, DXC fallback for
  Wine, rectangle pass). #1279's structured-buffer clamp and its readback
  test (written for the old bound/done API) are left out.
- draw.rs: NOT_MADE counter, user_dword, typed table nulls
  (table_view_props, mirror_for_draw); the depth test calls readable()
  directly since our tables() needs a host pipeline.
- frame.rs: our `_tick` (the diagnostics log already names it).
- list.rs: execute_indirect's DISPATCH_SINGLE mapping in one place; our
  tests beside the bundle's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Proposed close. In crates/victory-gpu/src/pipeline/host.rs root_signature, this PR retries without CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED/SAMPLER_HEAP_DIRECTLY_INDEXED when the runtime rejects them. Translated shaders reach their descriptors through SM 6.6 heap indexing (victory-shader emit/mod.rs module docs, heap_handle in emit/lower.rs), and those shaders need the flags. So the fallback root signature serializes, but the pipelines built on it are refused.

The Windows 10 runs in this thread confirm this: after the fallback, every host pipeline is still refused with 0x80070057 (236 of 236 in one run), 0 draws are drawn, and the title crashes at the same address as without the PR. That crash was later traced to the auth path, not to this code, so "Fixes #598" does not hold. The new test only exercises the first path on a runtime that accepts the flags. The fallback also replaces a clear "root signature refused" error with a later, less obvious pipeline refusal.

On old runtimes, the fix is to load a runtime that supports these flags (Agility SDK, see #463/#969), which the maintainer would need to decide on. #1768 takes the same retry approach.

CI: no check runs on the head commit.

This pull request 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

geiyiliyabumo pushed a commit to geiyiliyabumo/VIctory that referenced this pull request Nov 25, 2026
…ndmask-415-111a

Shaders: track uniform and constant masks for v_cndmask (Marvisak#415)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash 0xc0000005 on world load due to unsupported root signature flags (c01/c00)

6 participants