Shaders: wire VICTORY_D3D12_DEBUG into emit::host pipeline checks #2566

Closed
fuzeofficlal wants to merge 1 commit from upstream-pr/2568 into main
fuzeofficlal commented 2026-11-25 16:01:38 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T16:01:38Z.


Refs #2537

Summary

Wires VICTORY_D3D12_DEBUG and D3D12 debug-layer message extraction into victory_shader::emit::host::Host (crates/victory-shader/src/emit/host.rs) so victory translate --pipelines reports driver/runtime refusal reasons instead of bare HRESULT strings:

  • Enables ID3D12Debug::EnableDebugLayer at most once per process (Once) in Host::new when VICTORY_D3D12_DEBUG is set and not "0", before any device is created (matching victory-gpu's switch semantics without adding fields to pub struct Host).
  • Wraps CreateComputePipelineState, CreateGraphicsPipelineState, and CreatePipelineState in Host::capture_pipeline_error:
    • Uses ID3D12InfoQueue1::RegisterMessageCallback scoped via an RAII guard into a thread_local! slot so multi-threaded translate --pipelines workers sharing the adapter's singleton ID3D12Device capture their own synchronous ERROR/CORRUPTION message without lock contention or cross-thread queue clearing.
    • Falls back to a mutex-guarded ID3D12InfoQueue read/clear path when ID3D12InfoQueue1 is unavailable.
    • Collapses whitespace/newlines to a single line (<debug reason> (<hresult>)) so translate --pipelines --list output and failure tally buckets stay well-formed.

Verification

  • Added subprocess integration test crates/victory-shader/tests/d3d12_debug_pipeline.rs testing VICTORY_D3D12_DEBUG=1 and VICTORY_D3D12_DEBUG=0 across compute, graphics, and mesh pipeline refusals (single-threaded and 4-thread concurrent workers) on both SM 6.6 hardware (RTX 5090) and D3D12 WARP.
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo xtask policy
<!-- greyfinch-sync:Marvisak/VIctory:issue:6608489554 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2568). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T16:01:38Z. --- Refs #2537 ## Summary Wires `VICTORY_D3D12_DEBUG` and D3D12 debug-layer message extraction into `victory_shader::emit::host::Host` (`crates/victory-shader/src/emit/host.rs`) so `victory translate --pipelines` reports driver/runtime refusal reasons instead of bare `HRESULT` strings: - Enables `ID3D12Debug::EnableDebugLayer` at most once per process (`Once`) in `Host::new` when `VICTORY_D3D12_DEBUG` is set and not `"0"`, before any device is created (matching `victory-gpu`'s switch semantics without adding fields to `pub struct Host`). - Wraps `CreateComputePipelineState`, `CreateGraphicsPipelineState`, and `CreatePipelineState` in `Host::capture_pipeline_error`: - Uses `ID3D12InfoQueue1::RegisterMessageCallback` scoped via an RAII guard into a `thread_local!` slot so multi-threaded `translate --pipelines` workers sharing the adapter's singleton `ID3D12Device` capture their own synchronous `ERROR`/`CORRUPTION` message without lock contention or cross-thread queue clearing. - Falls back to a mutex-guarded `ID3D12InfoQueue` read/clear path when `ID3D12InfoQueue1` is unavailable. - Collapses whitespace/newlines to a single line (`<debug reason> (<hresult>)`) so `translate --pipelines --list` output and failure tally buckets stay well-formed. ## Verification - Added subprocess integration test `crates/victory-shader/tests/d3d12_debug_pipeline.rs` testing `VICTORY_D3D12_DEBUG=1` and `VICTORY_D3D12_DEBUG=0` across compute, graphics, and mesh pipeline refusals (single-threaded and 4-thread concurrent workers) on both SM 6.6 hardware (RTX 5090) and D3D12 WARP. - `cargo clippy --workspace --all-targets -- -D warnings` - `cargo xtask policy`
upstream-sync closed this pull request 2026-11-25 20:05:40 +00:00
Marvisak commented 2026-11-25 20:06:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T19:25:52Z.


Automated triage for the maintainers.

Needs work: needs the maintainer's decision. It merges cleanly into main. CI: check passing.

With VICTORY_D3D12_DEBUG set, this enables the D3D12 debug layer in victory_shader::emit::host::Host::new. Pipeline-creation errors from the compute, graphics and mesh paths then carry the debug layer's first error message (capture_pipeline_error, using ID3D12InfoQueue1 callbacks with an ID3D12InfoQueue fallback). Better error text for the shader test host is useful, but a few things need changing:

  • victory-gpu enables the debug layer only in diagnostics builds (host::create), while here it turns on whenever the variable is set. Please gate it on the existing diagnostics feature or explain the difference.
  • The new test tests/d3d12_debug_pipeline.rs re-runs its own binary as a child process, which needs the maintainer's decision.
  • The test's check is loose: any message containing "Shader" passes.
  • The GS: hunk in pipeline_with only reformats code. Please drop it.

#2560 and #2562 address the same issue (#2537), so the maintainer may want to pick one.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7172285804 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2568#issuecomment-7172285804). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T19:25:52Z. --- <!-- victory-triage v1 head=b770d3af74d8713127b3164866e3a8793bcab997 verdict=needs-work at=2026-11-25T19:48:00Z --> Automated triage for the maintainers. **Needs work: needs the maintainer's decision.** It merges cleanly into `main`. CI: `check` passing. With `VICTORY_D3D12_DEBUG` set, this enables the D3D12 debug layer in `victory_shader::emit::host::Host::new`. Pipeline-creation errors from the compute, graphics and mesh paths then carry the debug layer's first error message (`capture_pipeline_error`, using `ID3D12InfoQueue1` callbacks with an `ID3D12InfoQueue` fallback). Better error text for the shader test host is useful, but a few things need changing: - `victory-gpu` enables the debug layer only in `diagnostics` builds (`host::create`), while here it turns on whenever the variable is set. Please gate it on the existing `diagnostics` feature or explain the difference. - The new test `tests/d3d12_debug_pipeline.rs` re-runs its own binary as a child process, which needs the maintainer's decision. - The test's check is loose: any message containing "Shader" passes. - The `GS:` hunk in `pipeline_with` only reformats code. Please drop it. #2560 and #2562 address the same issue (#2537), so the maintainer may want to pick one. --- _Generated by [Claude Code](https://claude.ai/code)_
fuzeofficlal commented 2026-11-25 20:06:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T19:37:41Z.


Closing in favor of #2562, which already addresses #2537 with diagnostics gating and --only <stages> and is marked triage: merge candidate. No need to keep a duplicate open.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7172556127 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2568#issuecomment-7172556127). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T19:37:41Z. --- Closing in favor of #2562, which already addresses #2537 with `diagnostics` gating and `--only <stages>` and is marked `triage: merge candidate`. No need to keep a duplicate open.

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