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

Closed
pablogonz12 wants to merge 3 commits from upstream-pr/1768 into main
pablogonz12 commented 2026-11-24 22:14:05 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pablogonz12 on 2026-11-24T22:14:05Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6592466522 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1768). Originally posted by [pablogonz12](https://github.com/pablogonz12) on 2026-11-24T22:14:05Z. --- 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.
catminou4 commented 2026-11-24 23:05:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T22:18:32Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:Marvisak/VIctory:review:6048297141 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1768#pullrequestreview-6048297141). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T22:18:32Z. **Review:** COMMENTED --- 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.
DesertGamer commented 2026-11-24 23:05:49 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DesertGamer on 2026-11-24T22:15:04Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7145995591 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1768#issuecomment-7145995591). Originally posted by [DesertGamer](https://github.com/DesertGamer) on 2026-11-24T22:15:04Z. --- ### 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). :warning: 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.*
ericomeehan commented 2026-11-25 00:06:49 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by ericomeehan on 2026-11-24T23:31:17Z.


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).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7147493019 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1768#issuecomment-7147493019). Originally posted by [ericomeehan](https://github.com/ericomeehan) on 2026-11-24T23:31:17Z. --- 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).
pablogonz12 commented 2026-11-25 04:07:01 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pablogonz12 on 2026-11-25T03:41:05Z.


Fixed in 6af59ce87: 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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7152146565 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1768#issuecomment-7152146565). Originally posted by [pablogonz12](https://github.com/pablogonz12) on 2026-11-25T03:41:05Z. --- Fixed in 6af59ce87: 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 2026-11-25 07:03:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T06:16:21Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7154619683 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1768#issuecomment-7154619683). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T06:16:21Z. --- <!-- victory-triage v1 head=6af59ce8744a371f10253d21eadc74420fdf7809 verdict=proposed-close at=2026-11-25T07:27:01Z --> 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](https://claude.ai/code)_
pablogonz12 commented 2026-11-25 07:03:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pablogonz12 on 2026-11-25T06:30:57Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7154869885 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1768#issuecomment-7154869885). Originally posted by [pablogonz12](https://github.com/pablogonz12) on 2026-11-25T06:30:57Z. --- 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.
upstream-sync closed this pull request 2026-11-25 12:02:25 +00:00
pablogonz12 commented 2026-11-25 12:03:50 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pablogonz12 on 2026-11-25T11:35:25Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7161243210 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1768#issuecomment-7161243210). Originally posted by [pablogonz12](https://github.com/pablogonz12) on 2026-11-25T11:35:25Z. --- Closing this one myself as discussed above: it doesn't earn its place. Thanks for the review.

Pull request closed

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!1767
No description provided.