GPU: disable implicit stream depth test without a DSV format #2535

Manually merged
github merged 1 commit from github-bot/gh-2535 into main 2026-11-30 14:16:59 +00:00 AGit
Owner

@⁠fuzeofficlal on GitHub · 2026-11-29 13:56 UTC · original
fuzeofficlal:fix/gpu-stream-omitted-depth-default → main · +159 −4 · 2 files · 1 commits · merged 2026-11-30 14:12 UTC

Summary

When a D3D12_PIPELINE_STATE_STREAM_DESC omits both depth-stencil subobjects (DEPTH_STENCIL kind 11 and DEPTH_STENCIL1 kind 21), D3D12's stream parser defaults DepthEnable to TRUE only when a DSVFormat is present (!= DXGI_FORMAT_UNKNOWN) and to FALSE when DSVFormat == DXGI_FORMAT_UNKNOWN.

Previously GraphicsState::default() left DepthEnable = TRUE unconditionally, so HostPipeline::new emitted an explicit depth-stencil state with DepthEnable = TRUE even for color-only pipeline streams that omitted depth-stencil state and had DXGI_FORMAT_UNKNOWN. On host D3D12 (for example, color-only streams using ForcedSampleCount > 0), CreateGraphicsPipelineState / CreatePipelineState refuses that explicit DepthEnable = TRUE state with E_INVALIDARG (0x80070057), causing draws using the pipeline to be dropped.

Changes

  • Track whether a stream supplied a depth-stencil subobject (kind 11 | 21) in create_stream (crates/victory-gpu/src/pipeline.rs) and call GraphicsState::apply_stream_defaults(has_depth_stencil) once all subobjects are parsed (independent of subobject order relative to DSVFormat kind 16).
  • In GraphicsState::apply_stream_defaults (crates/victory-gpu/src/pipeline/host.rs), set DepthEnable = FALSE when !has_depth_stencil && self.depth_format == DXGI_FORMAT_UNKNOWN.
  • Add unit and live D3D12 PSO creation tests covering omitted depth-stencil with DXGI_FORMAT_UNKNOWN vs DXGI_FORMAT_D32_FLOAT, explicit kind 11/21 overrides, and color-only streams with ForcedSampleCount = 1.

Verification

  • cargo test --locked -p victory-gpu --lib pipeline::host::tests::omitted_stream_depth & explicit_stream_depth_overrides_dsv_default — pass on RTX 5090 (VICTORY_ADAPTER=NVIDIA, VICTORY_D3D12_DEBUG=1) and WARP (VICTORY_D3D12_WARP=1, VICTORY_D3D12_DEBUG=1).
  • cargo clippy --locked -p victory-gpu --tests — 0 new warnings in touched files.
  • cargo run --quiet --locked -p xtask -- policy --staged — pass.
**@⁠fuzeofficlal** on GitHub · 2026-11-29 13:56 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2535) `fuzeofficlal:fix/gpu-stream-omitted-depth-default` → `main` · +159 −4 · 2 files · 1 commits · merged 2026-11-30 14:12 UTC ### Summary When a `D3D12_PIPELINE_STATE_STREAM_DESC` omits both depth-stencil subobjects (`DEPTH_STENCIL` kind `11` and `DEPTH_STENCIL1` kind `21`), D3D12's stream parser defaults `DepthEnable` to `TRUE` only when a `DSVFormat` is present (`!= DXGI_FORMAT_UNKNOWN`) and to `FALSE` when `DSVFormat == DXGI_FORMAT_UNKNOWN`. Previously `GraphicsState::default()` left `DepthEnable = TRUE` unconditionally, so `HostPipeline::new` emitted an explicit depth-stencil state with `DepthEnable = TRUE` even for color-only pipeline streams that omitted depth-stencil state and had `DXGI_FORMAT_UNKNOWN`. On host D3D12 (for example, color-only streams using `ForcedSampleCount > 0`), `CreateGraphicsPipelineState` / `CreatePipelineState` refuses that explicit `DepthEnable = TRUE` state with `E_INVALIDARG` (`0x80070057`), causing draws using the pipeline to be dropped. ### Changes - Track whether a stream supplied a depth-stencil subobject (`kind 11 | 21`) in `create_stream` (`crates/victory-gpu/src/pipeline.rs`) and call `GraphicsState::apply_stream_defaults(has_depth_stencil)` once all subobjects are parsed (independent of subobject order relative to `DSVFormat` kind `16`). - In `GraphicsState::apply_stream_defaults` (`crates/victory-gpu/src/pipeline/host.rs`), set `DepthEnable = FALSE` when `!has_depth_stencil && self.depth_format == DXGI_FORMAT_UNKNOWN`. - Add unit and live D3D12 PSO creation tests covering omitted depth-stencil with `DXGI_FORMAT_UNKNOWN` vs `DXGI_FORMAT_D32_FLOAT`, explicit kind `11`/`21` overrides, and color-only streams with `ForcedSampleCount = 1`. ### Verification - `cargo test --locked -p victory-gpu --lib pipeline::host::tests::omitted_stream_depth` & `explicit_stream_depth_overrides_dsv_default` — pass on RTX 5090 (`VICTORY_ADAPTER=NVIDIA`, `VICTORY_D3D12_DEBUG=1`) and WARP (`VICTORY_D3D12_WARP=1`, `VICTORY_D3D12_DEBUG=1`). - `cargo clippy --locked -p victory-gpu --tests` — 0 new warnings in touched files. - `cargo run --quiet --locked -p xtask -- policy --staged` — pass.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 14:01:22 +00:00
github manually merged commit 7738c2ef75 into main 2026-11-30 14:16:59 +00:00
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/trustno1-coder--VIctory-NVIDIA!2535
No description provided.