Shaders: enable VICTORY_D3D12_DEBUG and report InfoQueue errors on pipeline refusal #2558

Closed
ashrafsdrop wants to merge 1 commit from upstream-pr/2560 into main
ashrafsdrop commented 2026-11-25 15:47:31 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by ashrafsdrop on 2026-11-25T15:47:31Z.


Resolves #2537:

Summary

  • In crates/victory-shader/src/emit/host.rs, Host::new previously ignored VICTORY_D3D12_DEBUG=1, so victory translate --pipelines reported bare HRESULT codes on pipeline refusals without any D3D12 debug layer diagnostics.
  • Enabled ID3D12Debug::EnableDebugLayer in Host::new before D3D12CreateDevice when VICTORY_D3D12_DEBUG=1 is set.
  • Routed compute (compute_pipeline_with), graphics (pipeline_gs), and mesh (mesh_pipeline_with) pipeline creation through Host::create_pipeline:
    • When VICTORY_D3D12_DEBUG=1 is unset, runs lock-free in parallel across workers.
    • When VICTORY_D3D12_DEBUG=1 is set, serializes pipeline creation and ID3D12InfoQueue clear/drain under a static Mutex so concurrent census workers sharing the adapter's D3D12 device never clear or steal each other's messages, and appends the first D3D12 error message to the returned error string.

Verification

  • Added emit::host::tests::debug_pipeline_creation_drains_info_queue_on_failure (passes with VICTORY_D3D12_DEBUG=1 on WARP).
  • cargo test -p victory-shader --lib emit::host::tests::debug_pipeline_creation_drains_info_queue_on_failure (1 passed).
  • cargo clippy -p victory-shader --all-targets --all-features -- -D warnings (clean).
  • cargo run -p xtask -- policy (184 files ok).
<!-- greyfinch-sync:Marvisak/VIctory:issue:6608286661 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2560). Originally posted by [ashrafsdrop](https://github.com/ashrafsdrop) on 2026-11-25T15:47:31Z. --- Resolves #2537: ### Summary - In `crates/victory-shader/src/emit/host.rs`, `Host::new` previously ignored `VICTORY_D3D12_DEBUG=1`, so `victory translate --pipelines` reported bare HRESULT codes on pipeline refusals without any D3D12 debug layer diagnostics. - Enabled `ID3D12Debug::EnableDebugLayer` in `Host::new` before `D3D12CreateDevice` when `VICTORY_D3D12_DEBUG=1` is set. - Routed compute (`compute_pipeline_with`), graphics (`pipeline_gs`), and mesh (`mesh_pipeline_with`) pipeline creation through `Host::create_pipeline`: - When `VICTORY_D3D12_DEBUG=1` is unset, runs lock-free in parallel across workers. - When `VICTORY_D3D12_DEBUG=1` is set, serializes pipeline creation and `ID3D12InfoQueue` clear/drain under a static `Mutex` so concurrent census workers sharing the adapter's D3D12 device never clear or steal each other's messages, and appends the first D3D12 error message to the returned error string. ### Verification - Added `emit::host::tests::debug_pipeline_creation_drains_info_queue_on_failure` (passes with `VICTORY_D3D12_DEBUG=1` on WARP). - `cargo test -p victory-shader --lib emit::host::tests::debug_pipeline_creation_drains_info_queue_on_failure` (1 passed). - `cargo clippy -p victory-shader --all-targets --all-features -- -D warnings` (clean). - `cargo run -p xtask -- policy` (184 files ok).
Marvisak commented 2026-11-25 19:06:27 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T18:39:37Z.


Automated triage for the maintainers.

Proposed close. Duplicate of #2562. This enables the D3D12 debug layer in emit::host::create_device under VICTORY_D3D12_DEBUG=1 and adds the first ID3D12InfoQueue error to pipeline-creation failures. #2562 covers the same goal (#2537) more completely: it gates on the diagnostics feature like victory-gpu/src/host.rs, enables the layer once before the process's first device, reports refused root signatures too, and adds --only. Two points from the earlier review are also still open here: the layer is enabled inside create_device rather than once per process, and create_pipeline calls ClearStoredMessages on the shared device's queue. If something here is missing from #2562, please raise it there.

CI: passing.

This PR 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:7171216290 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2560#issuecomment-7171216290). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T18:39:37Z. --- <!-- victory-triage v1 head=e384e9ec0dd723aa010ebe986e393fd9c8d5f953 verdict=proposed-close at=2026-11-26T04:22:38Z --> Automated triage for the maintainers. **Proposed close.** **Duplicate of #2562.** This enables the D3D12 debug layer in `emit::host::create_device` under `VICTORY_D3D12_DEBUG=1` and adds the first `ID3D12InfoQueue` error to pipeline-creation failures. #2562 covers the same goal (#2537) more completely: it gates on the `diagnostics` feature like `victory-gpu/src/host.rs`, enables the layer once before the process's first device, reports refused root signatures too, and adds `--only`. Two points from the earlier review are also still open here: the layer is enabled inside `create_device` rather than once per process, and `create_pipeline` calls `ClearStoredMessages` on the shared device's queue. If something here is missing from #2562, please raise it there. CI: passing. This PR 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)_
KainanP commented 2026-11-25 23:06:30 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by KainanP on 2026-11-25T22:54:01Z.


Compared with #2562 on an RTX 4060 and WARP (no debug layer here). It adds no regressions, but it now conflicts with main and #2562, and it lacks the diagnostics gating, the root signatures and --only. Details: https://github.com/Marvisak/VIctory/issues/2537#issuecomment-7176909182 (AI-assisted)

<!-- greyfinch-sync:Marvisak/VIctory:comment:7176916297 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2560#issuecomment-7176916297). Originally posted by [KainanP](https://github.com/KainanP) on 2026-11-25T22:54:01Z. --- Compared with #2562 on an RTX 4060 and WARP (no debug layer here). It adds no regressions, but it now conflicts with `main` and #2562, and it lacks the `diagnostics` gating, the root signatures and `--only`. Details: https://github.com/Marvisak/VIctory/issues/2537#issuecomment-7176909182 (AI-assisted)
upstream-sync closed this pull request 2026-11-26 06:02:31 +00:00
ashrafsdrop commented 2026-11-26 06:03:45 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by ashrafsdrop on 2026-11-26T05:38:39Z.


Closing in favor of #2562 which covers the diagnostics gating, once-per-process init, and --only flag

<!-- greyfinch-sync:Marvisak/VIctory:comment:7183673664 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2560#issuecomment-7183673664). Originally posted by [ashrafsdrop](https://github.com/ashrafsdrop) on 2026-11-26T05:38:39Z. --- Closing in favor of #2562 which covers the diagnostics gating, once-per-process init, and --only flag

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