Skip to content

GPU: retry a root signature without the heap-directly-indexed flags when the host refuses them - #1768

Closed
pablogonz12 wants to merge 3 commits into
Marvisak:mainfrom
pablogonz12:up/1532-root-heap-flags
Closed

pablogonz12 wants to merge 3 commits into
Marvisak:mainfrom
pablogonz12:up/1532-root-heap-flags

Conversation

@pablogonz12

Copy link
Copy Markdown
Contributor

Fixes #1532

What. D3D12SerializeRootSignature and D3D12SerializeVersionedRootSignature are given the title's description with the console-only flags (bits 24 and up) already cleared. Two more flags, CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED (0x400) and SAMPLER_HEAP_DIRECTLY_INDEXED (0x800), are PC flags, but only a runtime with shader model 6.6 dynamic resources knows them; an older one (WARP without the Agility SDK, vkd3d-proton under Wine) refuses the whole description with E_INVALIDARG, which is the 0xC01 in the report. A refusal that carries either bit is now retried once with those two bits dropped, and logged at debug; no other flag and no other failure is touched.

Why. The title asks for 0xC01, so on a host that refuses it the root signature, and every pipeline that names it, is lost. With the retry the title keeps a usable root signature; only shaders that index the descriptor heaps directly lose the flag, and a host without those flags cannot run them anyway.

Tested

  • New test root::tests::the_heap_flags_are_dropped_only_after_the_host_refuses_them, with a fake serializer that refuses 0xC01 the way the report describes: 0xC01 → attempts 0xC01 then 0x1 and S_OK; 0x41 → one attempt; versioned 0xC03 → 0xC03 then 0x3; a fake that always fails → E_INVALIDARG comes back unchanged.
  • cargo test -p victory-gpu --lib (Linux host): 25 passed, 0 failed.
  • cargo xwin clippy --workspace --all-targets [--all-features] --target x86_64-pc-windows-msvc -- -D warnings: clean.

Not tested. The refusal itself: there is no WARP or old-Agility host here (Linux, RADV), so the retry is covered by the unit test only; no game run.

AI-assisted (DeepSeek via OpenCode), no game data.

A host whose D3D12 runtime predates shader model 6.6 dynamic resources (WARP
without the Agility SDK, vkd3d-proton under Wine) refuses a description that
carries CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED (0x400) or
SAMPLER_HEAP_DIRECTLY_INDEXED (0x800) with E_INVALIDARG. The title asks for
0xC01, so the whole root signature, and every pipeline naming it, was lost.
Retry once without those two bits, and only after the host refused; every
other flag and failure is untouched. Fixes Marvisak#1532.
@DesertGamer

Copy link
Copy Markdown

VIctory V2: community PRs, merged and tested

Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch.

Where it stands today: launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1).

⚠️ Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk.

Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help:
https://DesertGamer/VIctory-V2

Unofficial community fork of Marvisak/VIctory, GPL-3.0.

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static review only: Windows-only code (D3D12/windows_sys/Win32) — nothing compiles or runs on macOS; source review of the diff.

Root signature serialization retries without the heap-directly-indexed flags when the device refuses them: serialize_with/retry_without_heap_flags + serialize_versioned_with, with refuses_heap_flags test doubles for both paths. This is the standard D3D12 fallback for older drivers — the retry must preserve the original flags for devices that accept them, which the structure does. Windows-only.

@ericomeehan

Copy link
Copy Markdown

Retrying once without the heap-directly-indexed flags is a neat way to keep WARP and vkd3d hosts going, and the fake-host tests pin the retry order nicely.

One small leak: in serialize_with / retry_without_heap_flags and in serialize_versioned_with, the first call can store an error blob in *error before failing, and the retry is passed the same error pointer, so that first blob is overwritten without being released. Passing a local out-pointer to the first attempt (and releasing what it gets back if you retry), or releasing *error before the retry when it is non-null, would avoid it. Also, a once-only warn instead of debug for the retry would help testers see that shaders indexing the heap directly will still be refused on that host.

Written with an AI assistant (Claude).

D3D12SerializeRootSignature hands out an ID3DBlob through ;
serialize_with passed the caller's pointer to both attempts, so the
retry overwrote the first blob without releasing it. The first attempt
now writes to a local pointer: it is released before the retry and
handed to the caller otherwise (released too when it asked for none).
Same for the versioned entry point. Test: a fake host that leaves a
COM-shaped blob behind.
@pablogonz12

Copy link
Copy Markdown
Contributor Author

Fixed in 6af59ce: the first attempt writes its error blob to a local pointer, which is released before the retry (and handed to the caller untouched when there is no retry; also released when the caller passed a null error), in both serialize_with and serialize_versioned_with (crates/victory-gpu/src/root.rs). Added the_first_error_blob_is_released_by_a_retry with a fake host that leaves a COM-shaped blob behind: one release on the retried path, none when the first attempt is final. Not tested on Windows/WARP this cycle; cargo xwin clippy --workspace --all-targets --target x86_64-pc-windows-msvc -- -D warnings is clean.

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Proposed close. In crates/victory-gpu/src/root.rs, serialize_with / serialize_versioned_with retry a refused root signature without CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED/SAMPLER_HEAP_DIRECTLY_INDEXED. The error-blob handling in 6af59ce looks right. The problem is what the retry achieves. The host pipelines' own root signature (pipeline/host.rs, around line 776) always sets both flags, and translated shaders reach descriptors through SM 6.6 heap indexing (victory-shader emit/mod.rs). So a host that refuses these flags still cannot build any pipeline. The Windows 10 runs on #626, which took the same approach, showed exactly that. The README lists SM 6.6 as a requirement.

Update after your reply: thanks for checking this against the tree. As you say, the one case that would still justify the retry is a supported SM 6.6 host that refuses the flags only on the 1.0 D3D12SerializeRootSignature path. A log from such a host would change this verdict.

CI: check passing.

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

github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 25, 2026
…ectly-indexed flags when the host refuses them
@pablogonz12

Copy link
Copy Markdown
Contributor Author

Checked the mechanism against the tree and you are right: every translated shader reaches descriptors through ResourceDescriptorHeap/SamplerDescriptorHeap (crates/victory-shader/src/emit/mod.rs:19-22), and every host pipeline signature sets both flags unconditionally (crates/victory-gpu/src/pipeline/host.rs:776-777), so a host that refuses 0xC01 refuses the host signatures as well and the retry only moves the failure to pipeline creation.

We have no log of an SM 6.6 host refusing the title's flags: our only host is RADV on Linux, and the Windows 10 runs on #626 refused every pipeline, which matches your reading of that PR. I am not going to defend the patch on the same premise, so I am not pushing a change; if the label stays, close it. The one case that would still make it worthwhile is a supported host that refuses 0xC01 only on the 1.0 D3D12SerializeRootSignature path (the title serializes with 1.0, the host signatures use the 1.1 versioned call), and I cannot test that here.

@pablogonz12

Copy link
Copy Markdown
Contributor Author

Closing this one myself as discussed above: it doesn't earn its place. Thanks for the review.

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.

Report the issue root signature flags 0xC01

5 participants