Skip to content

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

Closed
fuzeofficlal wants to merge 1 commit into
Marvisak:mainfrom
fuzeofficlal:fix/shader-host-d3d12-debug-reasons-2537
Closed

fuzeofficlal wants to merge 1 commit into
Marvisak:mainfrom
fuzeofficlal:fix/shader-host-d3d12-debug-reasons-2537

Conversation

@fuzeofficlal

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Owner

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

@fuzeofficlal

Copy link
Copy Markdown
Contributor Author

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.

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.

2 participants