d3d12-gpu: keep depth stage active on WARP for bounds-only pipelines (D3D12-DEPTH-BOUNDS-TEST-FLAKE) #2663
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2663"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-30T00:16:19Z.
Claimed in the coordination issue as: D3D12-DEPTH-BOUNDS-TEST-FLAKE (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7264381245)
What and why
Fixes the failure in
pipeline::host::tests::depth_bounds_pipeline_loads_and_filters_draws(depth 0.5 outside [0.6, 1.0] must be rejected, returning255instead of0— the sole failing test in #2648'sd3d12 (windows-latest)job and reported in https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7263423389):DepthBoundsTestEnableis used withoutDepthEnable(d3d12/crates/leonida-gpu/src/pipeline/host.rs):DepthBoundsTestEnableistruewithDepthEnable == falseandStencilEnable == false, Microsoft WARP (d3d10warp.dll, used on CPU-only hosts andwindows-latestCI runners) bypasses the depth-stencil stage on directDEPTH_STENCIL1PSOs and passes fragments (20/20deterministic failures even for impossible intervals such as[-2.0, -1.0]and[2.0, 3.0]).effective_depth_bounds_desc(applied inGraphicsState::depth1for both graphics and mesh pipelines and ingraphics_depth_bounds_pipeline) promotesDepthBoundsTestEnable && !DepthEnable && dsv_format != DXGI_FORMAT_UNKNOWNtoDepthEnable = true,DepthWriteMask = D3D12_DEPTH_WRITE_MASK_ZERO,DepthFunc = D3D12_COMPARISON_FUNC_ALWAYS.D3D12_DSV_FLAG_READ_ONLY_DEPTHread-only DSVs under the D3D12 debug layer) while forcing WARP and early-Z-gated drivers to fetch the DSV and evaluate[MinDepthBounds, MaxDepthBounds]. WhenDSVFormat == DXGI_FORMAT_UNKNOWN,DepthEnablestaysfalse; whenDepthEnableis alreadytrue, the caller'sDepthFuncandDepthWriteMaskare preserved unchanged.GraphicsState::screen_passalso excludesself.depth_bounds, andGraphicsState::describedistinguishes normalized bounds-only state (depth-bounds-always) so pre-existing pipeline-library caches do not collide onStorePipeline(0changes ind3d12/crates/leonida-gpu/src/host.rs).d3d12/crates/leonida-gpu/src/pipeline/host.rs):depth_bounds_pipeline_loads_and_filters_drawsinstead of sharingHost::rtv/Host::dsv's lock-freeRTV_RINGacross ~550+ concurrent tests, records the target clears onfirst_listahead of the command-list cut, and compiles synthetic test shaders asvs_6_0/ps_6_0behinddevice_supports_depth_bounds_sm60so SM 6.2 WARP (Windows 10 22H2) runs both fixtures cleanly.depth_bounds_without_depth_test_enables_noop_always_depth_only_with_dsvanddepth_bounds_without_depth_test_filters_on_warp_and_in_parallel, which explicitly enumerateswarp_adapter()alongsidehost()and runs 4-thread concurrent writable and read-only DSV depth-bounds draws on everycargo test -p leonida-gpu --librun.effective_depth_bounds_descis proven deterministically load-bearing by the new parallel WARP fixture (which fails255vs0on writable and read-only DSVs whenever the promotion is reverted), whereas on WARP10.0.26100.9711(@KelboLive) the originaldepth_bounds_pipeline_loads_and_filters_drawsstill passes with the promotion reverted while other WARP builds reproduce255vs0underLEONIDA_D3D12_WARP=1— meaning the original CI failure could also stem from the sharedRTV_RING/ post-cut clear race fixed here rather than depth state alone.depth_bounds_pipeline_loads_and_filters_drawsin CI (.github/workflows/d3d12.yml):-- --skip depth_bounds_pipeline_loads_and_filters_drawsfrom.github/workflows/d3d12.yml(per the comment left in #2648 for #2663) sod3d12 (windows-latest)runs both depth-bounds fixtures directly on the hosted Windows runner.Tested
LEONIDA_D3D12_WARP=1and hardware GPUcargo test -p leonida-gpu --lib pipeline::host::tests -- --test-threads=4->11/11passed (0D3D12 debug-layer errors on initial diagnostic runs +25/25parallel WARP stress runs).10.0.20348.5756) and Server 2025 (10.0.26100.33648) WARP runners (@merzleckeier), Windows 10 22H2 SM 6.2 WARP10.0.19041.7811+ RTX 5070 (@lixonik), and Windows 11 WARP10.0.26100.9711+ RTX 4070 Ti SUPER (@KelboLive).python -I scripts/check_no_game_data.py->0issues.GPUs tested: Microsoft WARP (
d3d10warp.dll) and NVIDIA GeForce RTX 3090 (driver 610.88), Windows 11 Pro (26200).AI-assisted: authored with Gemini 4 Carbon; independently reviewed with Gemini 4 Neon (
opus-systems-critic) plus external reviews noted above.Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-30T00:25:57Z.
[P2] Use a shader profile supported by the WARP adapter in the depth-bounds fixture
On Windows 10 22H2 (build 19045, system WARP 10.0.19041.7811), WARP advertises
DepthBoundsTestSupportedbut reports Shader Model 6.2. The new fixture compiles its synthetic shaders asvs_6_5andps_6_5. The WARP PSO returnsE_INVALIDARG(0x80070057) before the pixel assertions. I reproduced it on all four targeted reruns.On the same device and with the same DXC, the full fixture passed after lowering just those two shader profiles to
vs_6_0andps_6_0and adding a diagnostic shader-model query. The fixture uses basic shaders, so SM 6.0 lets it exercise depth bounds on this WARP version. The optional hardware pass also depends on getting through WARP setup and its capability guard. Running that pass independently would preserve hardware coverage when WARP lacks depth bounds.Tested
51ea09bf534bc5838f3e0bb14eebaef9d353856fmerged locally into452d1d1b68aa2da94d5f0eff43ad0a6a83bbbadf. The original nativepipeline::host::testsrun had 10 passes and this one failure. The descriptor test and existing hardware draw/readback test both passed. I used local test-executable loader exports for Agility SDK 1.614.1 and synthetic inputs only.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-30T00:32:30Z.
Good catch on Windows 10 22H2 WARP (
max SM 6.2)! Pushedc65f657c45updatingdepth_bounds_without_depth_test_filters_on_warp_and_in_parallel:vs_6_0andps_6_0and addeddevice_supports_depth_bounds_sm60checking bothDepthBoundsTestSupportedandD3D_SHADER_MODEL_6_0per device.warp_adapter()pass and thehost()hardware pass (run_parallel_depth_bounds_checkwith adapter-LUID deduplication) so hardware coverage still runs independently when WARP is unavailable or lacks depth-bounds support (11/11passing underLEONIDA_D3D12_WARP=1 LEONIDA_D3D12_DEBUG=1and on hardware).AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T00:42:31Z.
Hosted WARP follow-up to the #2648 depth-bounds failure. I built
c65f657c4(GitHub merge38cbdc263ontob8bd37111) withdiagnosticsand ran the tests withLEONIDA_D3D12_WARP=1andLEONIDA_D3D12_DEBUG=1. Windows Server 2025 build 26100, system WARP10.0.26100.33648, DXC1.9.2602.17. The fork commit only adds the probe workflow. Hosted Windows job.depth_bounds_pipeline_loads_and_filters_drawsfixture still usesvs_6_5/ps_6_5behind a depth-bounds-only device check. If the host is forced to the SM 6.2 WARP adapter from the Windows 10 report, that fixture is worth a focused check as well. The new parallel fixture now uses SM 6.0. Legacy fixture.Synthetic fixtures only. AI-assisted with OpenAI Codex.
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-30T00:45:28Z.
Thanks for the hosted
windows-latestverification (5/5processes clean)! Also lowereddepth_bounds_pipeline_loads_and_filters_drawstovs_6_0/ps_6_0withdevice_supports_depth_bounds_sm60inee9fb09755so both fixtures run cleanly whenLEONIDA_D3D12_WARP=1is forced on Windows 10 22H2 (SM 6.2WARP).AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T00:53:30Z.
Independent SM 6.0 follow-up on two hosted WARP versions. I tested
ee9fb0975(GitHub mergea7db42495ontob8bd37111) withdiagnostics,LEONIDA_D3D12_WARP=1,LEONIDA_D3D12_DEBUG=1and DXC 1.9.2602.17. The fork adds only the probe workflow. Server 2022 job · Server 2025 job.10.0.20348.5756) and Server 2025 (WARP10.0.26100.33648). Both the pipeline-library fixture and the parallel writable/read-only DSV fixture ran with no depth-bounds skip messages or D3D12 errors.pipeline::host::testsfilter reported 11 passed on each image. The optional mesh fixture returned early on Server 2022 because WARP did not advertise mesh shaders.This checks the updated fixture on the two Server WARP versions. The Windows 10 22H2 repro uses a different WARP build. Synthetic fixtures only. AI-assisted with OpenAI Codex.
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-30T01:19:53Z.
Retested the SM 6.0 update
ee9fb0975584a0a92f86de0778afe086a20927eamerged locally into0eab02a8bcffbb9d1609f9c2fba40c2357513d06, on the same Windows 10 22H2 machine as the original report (system WARP10.0.19041.7811, max SM 6.2, RTX 5070 on 610.88, DXC 1.9.0.5512).LEONIDA_D3D12_WARP=1,pipeline::host::testspassed 11/11. The optional mesh-shader fixture reported unsupported. All three depth-bounds tests passed in five fresh processes, with no depth-bounds skip. Both GPU fixtures reached their assertions and the originalE_INVALIDARGdid not recur.pipeline::host::testspassed 11/11 with no skip messages.Built with Rust 1.98.1,
--profile diag --features diagnostics, local test-executable loader exports for Agility SDK 1.614.1, and synthetic fixtures only. This resolves my Windows 10 review finding.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T14:37:13Z.
Review: COMMENTED
Verified the core claim end to end, which is what matters for a WARP-only flake: with
effective_depth_bounds_descshort-circuited, the WARP fixture reproduces the reported failure exactly (worker 0 iter 0 bounds [0.6, 1]→left: 255, right: 0, 4 workers) while the hardware fixture on the RTX 4070 Ti SUPER still passes; restored, all three tests pass. So the promotion is the fix, not a masking change.The shape is right:
DepthBoundsTestEnable && !DepthEnable && DSVFormat != UNKNOWN→DepthEnable = true,DepthWriteMask = ZERO,DepthFunc = ALWAYSpreserves the title's depth result and its writes, and it reaches both paths —depth1()→graphics_depth_bounds_pipeline, andmesh_pipeline(..., g.depth1(), ...).screen_passonly changes the scheduling flag, so no alternate pipeline path appears.Two details worth keeping exactly as they are:
depth-bounds-alwayssuffix indescribe()is necessary, not cosmetic: rawDepthEnable=falseis unchanged by the normalization, so without it a pre-fix library entry would be loaded instead of rebuilt.State here:
leonida-gpu --lib552/0/47, the merged tree 633/0/59 serially,check_no_game_dataanddiff --checkclean, andmerge-treeagainst current main is clean. One caveat only: the branch is 896 commits behind, so rebase before merging even though the merge is conflict-free. One of my parallel runs of the merged suite aborted without a summary and both the serial and a repeat parallel run were green — worth knowing, not blocking.Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T14:39:46Z.
One extra data point from a second WARP run here (10.0.26100.9711), worth a sentence in the body:
With the guard reverted, the new fixture fails exactly as expected (255 vs 0, read-only DSV included), but the original
depth_bounds_pipeline_loads_and_filters_drawsstill passes on this WARP even withLEONIDA_D3D12_WARP=1(depth_enable=false bounds=true dsv=40). So the promotion is proven load-bearing by the new fixture, while the old fixture's CI failure may have been the shared RTV/DSV ring race rather than the depth state — the two fixes in this PR are independent, and saying which one the old failure was would make the history clear.No objection to the change itself: both paths are covered, the cache suffix is necessary, and the SM 6.0 + feature probe is the right answer to the Windows 10 WARP report.
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T14:53:11Z.
A physical-GPU follow-up to the WARP results: I tested
ee9fb097merged intocd0c52fcf, Win64 MSVC target with diagnostics, under Wine 11.22 and VKD3D-Proton 3.1.0. Both new Rust tests passed on Radeon Raphael (RADV 26.3.1) and RTX 4070 SUPER (620.73.04). A local print after the parallel test’s host branch confirmed all four workers completed their eight draw/readback cases per GPU, including the read-only DSV and exact-bound case. Wine skipped the WARP branch.On both GPUs, the unmodified older depth_bounds_pipeline_loads_and_filters_draws failed on main and on the PR at the pipeline-library hit assertion. For a second diagnostic run I recorded that counter instead of asserting it, leaving the draw and readback assertions unchanged. The counter stayed 0 -> 0 on all four runs. Both main and PR then passed the original inside/outside depth readbacks on both GPUs. That baseline cache result is independent of the PR’s added depth checks in this setup. MEASURED with synthetic draw fixtures. AI-assisted (Codex).
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-12-01T14:54:27Z.
Thanks for the end-to-end verification and the
10.0.26100.9711WARP data point @KelboLive!effective_depth_bounds_descis load-bearing for the parallel WARP writable/read-only DSV fixture, whereasdepth_bounds_pipeline_loads_and_filters_drawspassing on10.0.26100.9711with the promotion reverted shows its intermittent CI failure could also come from the sharedRTV_RING/ clear-cut race).main(cd0c52fcf4) so the branch is up to date (0abaae0d7), and dropped-- --skip depth_bounds_pipeline_loads_and_filters_drawsfrom.github/workflows/d3d12.yml(per the comment left in #2648) sod3d12 (windows-latest)runs both depth-bounds fixtures directly in CI on this PR.AI-assisted: Gemini 4 Carbon. Tested on Windows 11, RTX 3090 (driver 610.88) +
LEONIDA_D3D12_WARP=1.