Skip to content

[upstream #1772] D3D12.X: default DepthEnable to false in stream_pipeline when DSVFormat is UNKNOWN - #360

Open
ufoptg wants to merge 1 commit into
mainfrom
upstream-pr/1772
Open

ufoptg wants to merge 1 commit into
mainfrom
upstream-pr/1772

Conversation

@ufoptg

@ufoptg ufoptg commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Fixes real::stream_pipeline so DepthStencilState.DepthEnable defaults to false when a D3D12_PIPELINE_STATE_STREAM_DESC omits the DEPTH_STENCIL / DEPTH_STENCIL1 / DEPTH_STENCIL2 subobject and DSVFormat is DXGI_FORMAT_UNKNOWN (0).

Previously stream_pipeline unconditionally initialized DepthEnable = true, violating D3D12 pipeline state stream defaults for graphics streams that neither bind a depth-stencil view nor supply a depth-stencil subobject.

Part of xcl-dev#1488 (XCL-BT-034).

What is in it

  • crates/xcl/src/hle/d3d12x/real.rs:
    • Track whether any depth-stencil subobject (11, 21, 26) was present in stream_pipeline.
    • After parsing subobjects, set g.DepthStencilState.DepthEnable = false.into() when !has_depth_stencil && g.DSVFormat.0 == 0 (DXGI_FORMAT_UNKNOWN). Streams with a non-UNKNOWN DSVFormat continue to default DepthEnable = true, and explicit depth-stencil subobjects are always preserved.
    • Add unit test stream_pipeline_defaults_depth_enable_from_dsv_format covering omitted/UNKNOWN DSVFormat, non-UNKNOWN DSVFormat, and explicit DEPTH_STENCIL subobjects.

Regression run

Baseline (immediate parent main b9b6ea6, warm shader/PSO cache):

xcl-smoke v1
commit: b9b6ea62080cc62fc19e212033372d01c6214e5c
gpu: AMD Radeon RX 6800
title: YouKnowWho
seconds: 60
exit: 0x0
frames shown: 1380 (PresentX 1380)
presents per 2 s (last 3): 59 60 15
device removals: 0
crashes: 0
peak commit: 14478 MB

This PR (fix/stream-pipeline-depth-default, warm shader/PSO cache):

xcl-smoke v1
commit: fa567957075adedf382f0d2d9ef9d967ea3b914e
gpu: AMD Radeon RX 6800
title: YouKnowWho
seconds: 60
exit: 0x0
frames shown: 1414 (PresentX 1414)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 11397 MB

Tested

Hardware: Windows 11 Pro for Workstations (Build 26300), Intel Core i9-9900K, 32 GB RAM, AMD Radeon RX 6800 (16337 MiB VRAM, Driver 32.0.21045.29003), rustc 1.100.0 (0ef1bc386 2026-11-09).

  • cargo test -p xcl --lib stream_pipeline_defaults_depth_enable_from_dsv_format: 1 passed; 0 failed; 0 ignored; 0 skipped.
  • XCL_REQUIRE_GPU=wave64,mesh cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 885 passed; 5 failed; 42 ignored; 0 skipped (3 pre-existing RDNA2 placed_title_textures_share_vram_and_preserve_pixels + VRAM_TEST_LOCK cascades tracked in D3D12.X: map a one-slice title texture's packed mips where D3D12 addresses them xcl-dev/xcl#470, plus 2 unrelated skip-gated tests that fail when XCL_REQUIRE_GPU is set: pso_measurement_compiles_an_exact_synthetic_record needing Windows Developer Mode and heap_window_out_of_memory_falls_back_to_the_switch_form needing XCL_HEAP_WINDOWS=1).
  • .\scripts\smoke.ps1 -Game '<game folder>\YouKnowWho' on b9b6ea62080cc62fc19e212033372d01c6214e5c and fa567957075adedf382f0d2d9ef9d967ea3b914e (see Regression run above).

Not tested

  • Non-AMD GPUs and Linux / Wine.

AI use

Antigravity (Gemini 4 Neon) implemented the DepthEnable default check and unit test in crates/xcl/src/hle/d3d12x/real.rs, and ran the full test suite and paired smoke runs.


Mirror of xcl-dev#1772 (auto-synced, do not edit).

…at is UNKNOWN

In 
eal::stream_pipeline, DepthStencilState.DepthEnable was unconditionally initialized to 	rue, even when a D3D12_PIPELINE_STATE_STREAM_DESC omitted DEPTH_STENCIL / DEPTH_STENCIL1 / DEPTH_STENCIL2 and had DSVFormat == DXGI_FORMAT_UNKNOWN (0).

Per D3D12 pipeline state stream rules, default DepthEnable to alse when no depth-stencil subobject is provided and DSVFormat == DXGI_FORMAT_UNKNOWN, while keeping DepthEnable = true when a non-UNKNOWN DSVFormat is present and always honoring explicit depth-stencil subobjects.

Part of xcl-dev#1488 (XCL-BT-034).

Assisted-by: Antigravity (Gemini 4 Neon)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants