Repository navigation
d3d12: support hardware depth-bounds testing and OMSetDepthBounds - #815
kotekompotek wants to merge 1 commit into
Conversation
abnalstlll-byte
left a comment
There was a problem hiding this comment.
Clean-Room Peer Review for PR #815 (d3d12: support hardware depth-bounds testing and OMSetDepthBounds)
Comprehensive technical evaluation of D3D12 <-> Vulkan dynamic depth-bounds translation:
- API Specification Parity:
- GraphicsCommandList::OMSetDepthBounds strictly adheres to ID3D12GraphicsCommandList1 spec.
- Correctly rejects command bundles (D3D12_COMMAND_LIST_TYPE_BUNDLE) via check(false).
- Rigorous range validation: !(min >= 0.0f && max <= 1.0f && min <= max) guards against inverted or out-of-range bounds, including NaN values.
- State reset (
eset_state) restores default [0.0f, 1.0f] range on pipeline recycling.
- Vulkan Backend Replay Integration:
- prepare_draw guards against unsupported depth-bounds test requests if �k.set_depth_bounds function pointer is absent.
- emit accurately binds dynamic state via �k.set_depth_bounds(command_buffer, draw->min_depth_bounds, draw->max_depth_bounds).
-
Test Suite Verification:
untime/test/d3d12_com_test.cpp: Verified retrieval and storage of dynamic depth bounds [0.25f, 0.75f].
untime/test/d3d12_mesh_test.cpp: Dynamic capability query against D3D12_FEATURE_D3D12_OPTIONS2::DepthBoundsTestSupported.
untime/test/d3d12_vulkan_device_test.cpp: Local invariant checks updated.
- Clean-room verification: Zero game data, strict C++20 compliance, clean MSVC/Clang compatibility.
LGTM! Excellent implementation and test coverage. Approved.
abnalstlll-byte
left a comment
There was a problem hiding this comment.
Clean-room verified (zero game data). Complete implementation of D3D12 depth-bounds testing: OPTIONS2 feature query, ID3D12GraphicsCommandList1::OMSetDepthBounds, dynamic state wiring in Vulkan context via depthBounds / vkCmdSetDepthBounds, and comprehensive tests.
c947f05 to
2f9bee4
Compare
|
Reviewed All five focused regression tests passed on baseline and HEAD. Independent pixel readback also confirmed correct depth-bounds clipping, default bounds, ClearState reset, pipeline switching, and no-DSV draws. Feature-disabled handling worked as expected. Found two API compatibility issues:
No draw-time or pipeline-creation Vulkan validation errors observed. Native Windows parity was not tested. |
|
Tested 2f9bee4 on NVIDIA GeForce RTX 3080 Ti Laptop (Ampere), NVIDIA 621.24, Vulkan 1.4.357, Windows 11 Pro (build 26300), native Windows: the three tests pass, but the depth-bounds path itself is not reached on this GPU Built at this head with
|
2f9bee4 to
b3ca7b5
Compare
|
@moffington @Sangonapou Thanks for the thorough review and WARP/bundle parity findings — addressed in
Locally verified:
|
|
@kotekompotek: a data point on why this matters. fxceless/victory-fork (a VIctory fork that renders gameplay on an RTX 4070) just landed the same thing in its commit c96b4f2 ("The depth bounds test works"): pipelines with depth bounds created from a DEPTH_STENCIL1 stream, and the title's On AI-assisted (Claude Code, Claude Opus 5.5). |
|
Retail data point for this PR: on main 3ff2a2a (native Windows 11, RTX 4070 SUPER), a 300 s boot to a first-run consent page logs 224 CreatePipelineState refusals for depth bounds, the most common PSO failure in the run. So every one of those draws is missing on main today. When you rebase, I'll A/B it on the same boot (refusal count, captures, and whether anything new appears on screen) and post the result here. AI-assisted (Claude Code, Claude Opus 5.5). |
b3ca7b5 to
efea973
Compare
|
Rebased onto current Verified locally on Windows / MSVC Debug (GTX 1050, driver 582.28): The head is ready for your RTX 4070 SUPER run — AI-assisted. |
|
Independent integration review while preparing an RTX 3070 Ti / Linux Wine test of exact efea973 on main 42537e7 (+ separately owned startup fixes): the patch cherry-picks cleanly, but main’s on-demand console-stream realization looks like a missed propagation path. In runtime/shims/d3d12_vulkan_device.cpp, PipelineState::prepare at line ~7059 parses the retained stream and calls create_graphics(stream.graphics, &stream.ms, &stream.as) without stream.extras (or back_stencil). Your eager CreatePipelineState path does pass &stream.extras, so DepthBoundsTestEnable appears to be lost specifically when a pending console stream is realized. This is a code-path observation, not yet a GPU measurement. I am preserving the exact patch in a separate local test tree and will check the focused synthetic path before retail use; not duplicating implementation ownership. The current runtime probes log 224 depth-bounds stream refusals without this PR, so the feature is relevant beyond conformance. No raw game-derived data included. AI-assisted. |
|
Real-boot A/B of this PR at efea973 on Windows 11, RTX 4070 SUPER (NVIDIA 621.24). The tree also had #1558, and slot 57's native factory was turned off so that pipelines go through the stream path (the configuration that draws the pages correctly, see #939). Same shaders and settings with and without the PR.
AI-assisted (Claude Code, Claude Opus 5.5). |
|
@djrolfes — picked up your finding as RT-DEPTHBOUNDS-STREAM-EXTRAS (claimed on #1608): #1695, branched from this PR's head Not compiled or GPU-confirmed on the author host; your RTX 3070 Ti / Wine plan would cover exactly the missing run when convenient. @kotekompotek — welcome to fold #1695 into #815 directly instead of a stacked PR; say the word and I drop the branch. AI-assisted. |
|
Status at @thiefyzheng thanks for picking up @djrolfes's console-stream finding. I'd keep #1695 stacked with |
efea973 to
a635392
Compare
|
Rebased onto current main (71a769d, post-#1671/#1691/#1703) — Local run on this box (GTX 1050, driver 582.28, Windows 11, Debug):
@djrolfes the conflict was mechanical; your lazy-path finding is covered separately by @thiefyzheng's #1695 stacked on this PR. |
…BOUNDS-ON-DEMAND-STREAM) ProjectLeonida#815 adds the depth-bounds extras to create_graphics and passes them where a stream is realized eagerly. A stream realized on demand (PipelineState:: set_pending_stream, resolved on first use) goes through a second call site that passes neither the extras nor the back-face stencil masks, so a title that binds a console PSO before it is realized silently loses DepthBoundsTestEnable - the test is then always on and clips nothing. Pass both at that call site. Test (d3d12_mesh_test): a stream PSO with DEPTH_STENCIL1 DepthBoundsTestEnable. Where the device has depthBounds, draw the full-screen triangle with bounds 0.9..1.0 and with 0.0..1.0: outside the bounds nothing may be painted, inside the whole viewport must be. Where it has not (llvmpipe here, depthBounds = false), the flag is refused - at creation, or at first use on an on-demand device - and success would mean the flag was dropped. Depends on: ProjectLeonida#815
…BOUNDS-ON-DEMAND-STREAM) A stream realized on demand (PipelineState::set_pending_stream, resolved on first use) goes through a second create_graphics call site that passes neither the depth-bounds flag nor the back-face stencil masks, so a title that binds a console PSO before it is realized silently loses DepthBoundsTestEnable - the test is then always on and clips nothing. Pass both there, as the eager call site does. Test (d3d12_mesh_test): the stream PSO with DepthBoundsTestEnable is now drawn through. Depth is cleared to 0.0, outside the first bounds, so the test decides and not the clear; the full-screen triangle is drawn with 0.9..1.0 (nothing may paint) and 0.0..1.0 (the whole viewport must). The draws use their own readback buffer, so the mesh image rows compared later are untouched. Where the device has no depthBounds (llvmpipe here) the creation is refused instead and success would mean the flag was dropped. Depends on: ubiquitarianism#815
Claimed in the coordination issue as: D3D-DEPTH-BOUNDS (#14 (comment))
What and why
main.DEPTH_STENCIL1/DEPTH_STENCIL2DepthBoundsTestEnable,VK_DYNAMIC_STATE_DEPTH_BOUNDS,ID3D12GraphicsCommandList1::OMSetDepthBounds,OPTIONS2::DepthBoundsTestSupported).OMSetDepthBoundsinruntime/shims/d3d12_com.cppto support bundles viadefer()and match D3D12Close() == S_OKon<0,>1,min>max, andNaN(sanitized cleanly to Vulkan[0, 1]or empty[1, 0]inruntime/src/vulkan_replay.h).info.features.depthBounds = d.enabled.depthBoundsind3d12_mesh_test.cppandd3d12_vulkan_device_test.cpp; expandedd3d12_com_test.cpp,d3d12_bundle_forbidden_test.cpp,d3d12_close_parity_test.cpp, and synceddocs/d3d12_vulkan.md.Tested
d3d12_com:Passed.d3d12_bundle_forbidden:11/11vs host GTX 1050 & WARP (0 failures).d3d12_close_parity: all 5OMSetDepthBoundscases match WARP.d3d12_vulkan_device(compare_feature_options):32 feature queries, 0 mismatches.d3d12_mesh_test.cppcompiled/W4, andtest_ctest_registration.py+test_docs_*.py:OK.GPUs tested: NVIDIA GeForce GTX 1050 (driver 582.28, Windows) & Microsoft Basic Render Driver (WARP)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.