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

Open
github-bot wants to merge 1 commit from github-bot/gh-2952 into main AGit
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 01:24 UTC · original
fuzeofficlal:fix/gpu-stream-omitted-depth-default → main · +169 −4 · 2 files · 1 commits · open

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 read_stream (crates/victory-gpu/src/pipeline.rs) and call GraphicsState::apply_stream_defaults(has_depth_stencil) once all subobjects are parsed (so subobject order relative to DSVFormat kind 16 does not matter, and both runtime create_stream and offline Prebuild stay identical).
  • 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 tests covering omitted depth-stencil with DXGI_FORMAT_UNKNOWN vs DXGI_FORMAT_D32_FLOAT, explicit kind 11/21 overrides, and live D3D12 host PSO creation for a color-only stream with ForcedSampleCount = 1.

Testing (Windows 11, Rust 1.98.1)

  • cargo test --locked -p victory-gpu --lib -- pipeline:: (RTX 5090, VICTORY_D3D12_DEBUG=1): 26/26 passed
  • cargo test --locked -p victory-gpu --features diagnostics --lib -- pipeline:: (RTX 5090, VICTORY_D3D12_DEBUG=1): 29/29 passed
  • cargo test --locked -p victory-gpu --features diagnostics --lib -- pipeline:: (WARP, VICTORY_D3D12_WARP=1, VICTORY_D3D12_DEBUG=1): 29/29 passed
  • cargo clippy --locked -p victory-gpu --tests -- -D warnings (default and --features diagnostics): 0 warnings
  • cargo xtask policy: 191 files ok
**@⁠fuzeofficlal** on GitHub · 2026-11-26 01:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/2952) `fuzeofficlal:fix/gpu-stream-omitted-depth-default` → `main` · +169 −4 · 2 files · 1 commits · open ### 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 `read_stream` (`crates/victory-gpu/src/pipeline.rs`) and call `GraphicsState::apply_stream_defaults(has_depth_stencil)` once all subobjects are parsed (so subobject order relative to `DSVFormat` kind `16` does not matter, and both runtime `create_stream` and offline `Prebuild` stay identical). - 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 tests covering omitted depth-stencil with `DXGI_FORMAT_UNKNOWN` vs `DXGI_FORMAT_D32_FLOAT`, explicit kind `11`/`21` overrides, and live D3D12 host PSO creation for a color-only stream with `ForcedSampleCount = 1`. ### Testing (Windows 11, Rust 1.98.1) - `cargo test --locked -p victory-gpu --lib -- pipeline::` (RTX 5090, `VICTORY_D3D12_DEBUG=1`): **26/26 passed** - `cargo test --locked -p victory-gpu --features diagnostics --lib -- pipeline::` (RTX 5090, `VICTORY_D3D12_DEBUG=1`): **29/29 passed** - `cargo test --locked -p victory-gpu --features diagnostics --lib -- pipeline::` (WARP, `VICTORY_D3D12_WARP=1`, `VICTORY_D3D12_DEBUG=1`): **29/29 passed** - `cargo clippy --locked -p victory-gpu --tests -- -D warnings` (default and `--features diagnostics`): **0 warnings** - `cargo xtask policy`: **`191 files ok`**
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:18:26 +00:00
Author
Owner

@⁠oni-swr on GitHub · 2026-11-26 01:51 UTC · original

Independent test report for 2cdb5e396f24b8cdf1baf27b3f24a8b29cfae404, with the exact parent 63bcca43c6a00a758510398fa43096ce7e4f7df0 as the control. Claim: #1633.

Setup: Windows 11 Pro 10.0.26200, Rust 1.98.1. Built with --features diagnostics and VICTORY_D3D12_WARP=1. A probe confirmed that the device the pipelines were made on is Microsoft Basic Render Driver (vendor 0x1414, device 0x8c, DXGI_ADAPTER_FLAG_SOFTWARE, no dedicated memory). Nothing ran on a physical GPU. All inputs were synthetic: FXC-compiled trivial VS/PS and hand-built streams. No game files were used.

PR tests: cargo test -j 4 --locked -p victory-gpu --features diagnostics --lib -- pipeline:: --test-threads=1

  • Head: 30/30 passed. The 3 new tests and my local probe pass.
  • Parent with only the PR's test hunk applied: 28 passed, 2 failed.
    • omitted_stream_depth_defaults_to_dsv_format fails because DepthEnable is true without a DSV format.
    • omitted_stream_depth_builds_forced_sample_count_pipeline fails because WARP refuses the PSO.
    • explicit_stream_depth_overrides_dsv_default passes on both revisions.

Live WARP matrix (local, uncommitted probe): RTV R8G8B8A8, HostPipeline::new. Each cell is DepthEnable / PSO built.

Stream Parent Head
no DSS, no DSV subobject, ForcedSampleCount=1 true / no false / yes
no DSS, DSV=UNKNOWN, FSC=1 true / no false / yes
no DSS, no DSV subobject, FSC=0 (plain color-only) true / yes false / yes
no DSS, DSV=UNKNOWN, FSC=0 true / yes false / yes
no DSS, DSV=D32_FLOAT, FSC=0 true / yes true / yes
no DSS, DSV=D24S8, FSC=0 true / yes true / yes
DSS (11) off, DSV=UNKNOWN, FSC=1 false / yes false / yes
DSS1 (21) off, DSV=UNKNOWN, FSC=1 false / yes false / yes
DSS (11) on, DSV=UNKNOWN, FSC=1 true / no true / no
DSS (11) on, DSV=D32, FSC=0 true / yes true / yes
DSV=D32 before DSS1 (21) off false / yes false / yes
DSV=UNKNOWN before DSS1 (21) on true / yes true / yes

The change only affects streams with no depth-stencil subobject and no DSV format. A depth-stencil subobject is still honored when explicitly present, in either order relative to the DSV format. That includes an explicit DepthEnable=TRUE with FSC=1, which WARP refuses on both revisions. A DSV format with no depth-stencil subobject still enables depth. The plain color-only pipeline builds on both revisions.

Broader checks at head:

  • cargo test -j 4 --locked -p victory-gpu --features diagnostics --lib: 249 passed, 0 failed, 1 ignored.
  • cargo clippy -j 4 --locked -p victory-gpu --features diagnostics --tests -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Limits:

  • WARP only. No hardware GPU, debug layer or title run.
  • I did not test the offline prebuild path separately beyond the existing a_prebuild_is_the_pipeline_the_title_creates.
  • Open PRs that touch the same files (#2897, #2911, #2868, #2801, #2767, #2729, #2951) did not obviously overlap the depth default. I did not test any merge combinations.

This is an independent test only, not a review. Prepared with Claude Code (Claude Opus 5.5).

**@⁠oni-swr** on GitHub · 2026-11-26 01:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/2952#issuecomment-7180201448) Independent test report for `2cdb5e396f24b8cdf1baf27b3f24a8b29cfae404`, with the exact parent `63bcca43c6a00a758510398fa43096ce7e4f7df0` as the control. Claim: #1633. **Setup:** Windows 11 Pro 10.0.26200, Rust 1.98.1. Built with `--features diagnostics` and `VICTORY_D3D12_WARP=1`. A probe confirmed that the device the pipelines were made on is `Microsoft Basic Render Driver` (vendor 0x1414, device 0x8c, `DXGI_ADAPTER_FLAG_SOFTWARE`, no dedicated memory). Nothing ran on a physical GPU. All inputs were synthetic: FXC-compiled trivial VS/PS and hand-built streams. No game files were used. **PR tests:** `cargo test -j 4 --locked -p victory-gpu --features diagnostics --lib -- pipeline:: --test-threads=1` - Head: 30/30 passed. The 3 new tests and my local probe pass. - Parent with only the PR's test hunk applied: 28 passed, 2 failed. - `omitted_stream_depth_defaults_to_dsv_format` fails because DepthEnable is true without a DSV format. - `omitted_stream_depth_builds_forced_sample_count_pipeline` fails because WARP refuses the PSO. - `explicit_stream_depth_overrides_dsv_default` passes on both revisions. **Live WARP matrix (local, uncommitted probe):** RTV R8G8B8A8, `HostPipeline::new`. Each cell is DepthEnable / PSO built. | Stream | Parent | Head | |---|---|---| | no DSS, no DSV subobject, ForcedSampleCount=1 | true / **no** | false / yes | | no DSS, DSV=UNKNOWN, FSC=1 | true / **no** | false / yes | | no DSS, no DSV subobject, FSC=0 (plain color-only) | true / yes | false / yes | | no DSS, DSV=UNKNOWN, FSC=0 | true / yes | false / yes | | no DSS, DSV=D32_FLOAT, FSC=0 | true / yes | true / yes | | no DSS, DSV=D24S8, FSC=0 | true / yes | true / yes | | DSS (11) off, DSV=UNKNOWN, FSC=1 | false / yes | false / yes | | DSS1 (21) off, DSV=UNKNOWN, FSC=1 | false / yes | false / yes | | DSS (11) on, DSV=UNKNOWN, FSC=1 | true / no | true / no | | DSS (11) on, DSV=D32, FSC=0 | true / yes | true / yes | | DSV=D32 before DSS1 (21) off | false / yes | false / yes | | DSV=UNKNOWN before DSS1 (21) on | true / yes | true / yes | The change only affects streams with no depth-stencil subobject and no DSV format. A depth-stencil subobject is still honored when explicitly present, in either order relative to the DSV format. That includes an explicit DepthEnable=TRUE with FSC=1, which WARP refuses on both revisions. A DSV format with no depth-stencil subobject still enables depth. The plain color-only pipeline builds on both revisions. **Broader checks at head:** - `cargo test -j 4 --locked -p victory-gpu --features diagnostics --lib`: 249 passed, 0 failed, 1 ignored. - `cargo clippy -j 4 --locked -p victory-gpu --features diagnostics --tests -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. **Limits:** - WARP only. No hardware GPU, debug layer or title run. - I did not test the offline prebuild path separately beyond the existing `a_prebuild_is_the_pipeline_the_title_creates`. - Open PRs that touch the same files (#2897, #2911, #2868, #2801, #2767, #2729, #2951) did not obviously overlap the depth default. I did not test any merge combinations. This is an independent test only, not a review. Prepared with Claude Code (Claude Opus 5.5).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 05:32 UTC · original

Automated triage for the maintainers.

Merge candidate. read_stream in victory-gpu/src/pipeline.rs now records whether a stream has a depth-stencil subobject (kind 11 or 21, the only two GraphicsState::read handles). After parsing, GraphicsState::apply_stream_defaults in pipeline/host.rs turns depth testing off when a stream has neither that subobject nor a DSV format. As far as I know, this is also how the public d3dx12 stream parse helper (DirectX-Headers) sets up a stream's default depth-stencil state. It runs after parsing, so subobject order does not matter, and the runtime and prebuild paths share it. The tests cover both defaults, an explicit 11/21 overriding them in either order, and a live PSO build with ForcedSampleCount = 1 (the case the host refused before). An independent WARP run in the comments shows the same before/after matrix.

CI: passing. Recommending a look, not approving.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-26 05:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/2952#issuecomment-7183576256) <!-- victory-triage v1 head=2cdb5e396f24b8cdf1baf27b3f24a8b29cfae404 verdict=merge-candidate at=2026-11-26T05:32:05Z --> Automated triage for the maintainers. **Merge candidate.** `read_stream` in `victory-gpu/src/pipeline.rs` now records whether a stream has a depth-stencil subobject (kind 11 or 21, the only two `GraphicsState::read` handles). After parsing, `GraphicsState::apply_stream_defaults` in `pipeline/host.rs` turns depth testing off when a stream has neither that subobject nor a DSV format. As far as I know, this is also how the public d3dx12 stream parse helper (DirectX-Headers) sets up a stream's default depth-stencil state. It runs after parsing, so subobject order does not matter, and the runtime and prebuild paths share it. The tests cover both defaults, an explicit 11/21 overriding them in either order, and a live PSO build with `ForcedSampleCount = 1` (the case the host refused before). An independent WARP run in the comments shows the same before/after matrix. CI: passing. Recommending a look, not approving. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2952/head:github-bot/gh-2952'
git switch 'github-bot/gh-2952'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2952'
git switch 'github-bot/gh-2952'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2952'
git switch 'github-bot/gh-2952'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2952'
git switch 'main'
git merge --squash 'github-bot/gh-2952'
git switch 'main'
git merge --ff-only 'github-bot/gh-2952'
git switch 'main'
git merge 'github-bot/gh-2952'
git push origin 'main'
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!2952
No description provided.