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

Closed
github-bot wants to merge 1 commit from gh-pr/2568/head into gh-pr/2568/base
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 16:01 UTC · original
fuzeofficlal:fix/shader-host-d3d12-debug-reasons-2537 → main · +313 −5 · 2 files · 1 commits · closed without merging

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
**@⁠fuzeofficlal** on GitHub · 2026-11-25 16:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/2568) `fuzeofficlal:fix/shader-host-d3d12-debug-reasons-2537` → `main` · +313 −5 · 2 files · 1 commits · closed without merging 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`
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:09:26 +00:00
github-bot closed this pull request 2026-11-26 05:09:26 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 19:25 UTC · original

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

**@⁠Marvisak** on GitHub · 2026-11-25 19:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/2568#issuecomment-7172285804) <!-- 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)_
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 19:37 UTC · original

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.

**@⁠fuzeofficlal** on GitHub · 2026-11-25 19:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/2568#issuecomment-7172556127) 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

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2568
No description provided.