d3d12: support hardware depth-bounds testing and OMSetDepthBounds #815
Open
github-bot
wants to merge 1 commit from
github-bot/gh-815 into main
AGit
pull from: github-bot/gh-815
merge into: github:main
github:main
github:docs/animation-merge-remnants
github:docs/story-dedup-and-cli
github:docs/restofworld-merge-remnants
github:docs/gamedata-dedup-tables
github:docs/textures-bcpack-tables-and-cli
github:docs/exe-fail-fast-shims-sync
github:fix/address-guard-wraparound-parity
github:fix/cvt-f16-denorm-and-clamp
github:docs/pso-cache-scope-note
github:docs/viewer-readme
github:docs/textures-arrays-dds-preview
github:docs/conformance-readme-status
github:fix/docs-validators-fences-urls
github:claude/loop-total
github:claude/pops-collision-seed
github:claude/dstorage-hold-page-reads
github:claude/host-image-copy-switch
github:feat/gdk-lifecycle-window-hook
github:claude/d16s8-uav-nvidia-fallback
github:feat/mfplat-offline-shim
github:claude/gameinput-slow-reader
github:fix/rt-null-barrier-clear
github:claude/depth-resolve-sample-positions
github:integration/palmetto-parity
github:claude/valu-literal-sext
github:claude/slot74-pool-handle
github:claude/rgb9e5-uint-alias-view
github:claude/fssm-root-layout-tables
github:feat/gdk-speech-display-lifecycle
github:asset-audio-skip-current
github:qemmhd/old-9940-rectangle-quad-lists
github:feat/ws2-offline-shim
github:qemmhd/rt-d16-unorm-uav
github:feat/xs-device-stops-7-9
github:qemmhd/rt-depth-same-base-shapes
github:qemmhd/rt-lazy-attachment-variant
github:feat/acphal-xma2-decoder
github:asset-audio-skip
github:codex/coord-claim-check-20261124-7e48
github:feat/xs-frame-pacing-presentx
github:feat/xs-device-vm-options
github:old-pr/9844
github:old-pr/9978
github:old-pr/9815
github:old-pr/10057
github:old-pr/9874
github:old-pr/9965
github:old-pr/9863
github:old-pr/10068
github:old-pr/10066
github:old-pr/10067
github:old-pr/10007
github:old-pr/10061
github:old-pr/10065
github:old-pr/10059
github:old-pr/10063
github:old-pr/10055
github:old-pr/10062
github:old-pr/10042
github:old-pr/10041
github:old-pr/10049
github:old-pr/10047
github:old-pr/10046
github:old-pr/10045
github:old-pr/10056
github:old-pr/10043
github:old-pr/10036
github:old-pr/10034
github:old-pr/9984
github:old-pr/10052
github:old-pr/10038
github:old-pr/10033
github:old-pr/10028
github:old-pr/10050
github:old-pr/9891
github:old-pr/9889
github:old-pr/10051
github:old-pr/10019
github:old-pr/10027
github:old-pr/10029
github:old-pr/10031
github:old-pr/10026
github:old-pr/9941
github:old-pr/10030
github:old-pr/10040
github:old-pr/9990
github:old-pr/10021
github:old-pr/9962
github:old-pr/10022
github:old-pr/10020
github:old-pr/10015
github:old-pr/10025
github:old-pr/9886
github:old-pr/10048
github:old-pr/10014
github:old-pr/10011
github:old-pr/9861
github:old-pr/10010
github:old-pr/10008
github:old-pr/9860
github:old-pr/10006
github:old-pr/9920
github:old-pr/9995
github:old-pr/10000
github:old-pr/10016
github:old-pr/10004
github:old-pr/10023
github:old-pr/9982
github:old-pr/9981
github:old-pr/9983
github:old-pr/9970
github:old-pr/9969
github:old-pr/9968
github:old-pr/9971
github:old-pr/9972
github:old-pr/9942
github:old-pr/9963
github:old-pr/9960
github:old-pr/9964
github:old-pr/9985
github:old-pr/9973
github:old-pr/9862
github:old-pr/9953
github:old-pr/10017
github:old-pr/9952
github:old-pr/9955
github:old-pr/9946
github:old-pr/9954
github:old-pr/9938
github:old-pr/9956
github:old-pr/9856
github:old-pr/9947
github:old-pr/9924
github:old-pr/9961
github:old-pr/9927
github:old-pr/9979
github:old-pr/10032
github:old-pr/9926
github:old-pr/5237
github:old-pr/9951
github:old-pr/9931
github:old-pr/9902
github:old-pr/9921
github:old-pr/9994
github:old-pr/9775
github:old-pr/9768
github:old-pr/9905
github:old-pr/9936
github:old-pr/9901
github:old-pr/9904
github:old-pr/9906
github:old-pr/9988
github:old-pr/9908
github:old-pr/9909
github:old-pr/9911
github:old-pr/9912
github:old-pr/9913
github:old-pr/9887
github:old-pr/9916
github:old-pr/9919
github:old-pr/9925
github:old-pr/9933
github:old-pr/9935
github:old-pr/9918
github:old-pr/9879
github:old-pr/9880
github:old-pr/9881
github:old-pr/9996
github:old-pr/9876
github:old-pr/9892
github:old-pr/9899
github:old-pr/9915
github:old-pr/9914
github:old-pr/9872
github:old-pr/9869
github:old-pr/9866
github:old-pr/9819
github:old-pr/10012
github:old-pr/9857
github:old-pr/9893
github:old-pr/9897
github:old-pr/9928
github:old-pr/9868
github:old-pr/9917
github:old-pr/9940
github:old-pr/9873
github:old-pr/9816
github:old-pr/10009
github:old-pr/9900
github:old-pr/9966
github:old-pr/9859
github:old-pr/9843
github:old-pr/9991
github:old-pr/10058
github:old-pr/9883
github:old-pr/9838
github:old-pr/9835
github:old-pr/9959
github:old-pr/9895
github:old-pr/9837
github:old-pr/9858
github:old-pr/9865
github:old-pr/9864
github:old-pr/9840
github:old-pr/9820
github:old-pr/4669
github:old-pr/9848
github:old-pr/9850
github:old-pr/9810
github:old-pr/9799
github:old-pr/9853
github:old-pr/9875
github:old-pr/9831
github:old-pr/9796
github:old-pr/9801
github:old-pr/9813
github:old-pr/9794
github:old-pr/7417
github:old-pr/9781
github:old-pr/9806
github:old-pr/9958
github:old-pr/9809
github:old-pr/9791
github:old-pr/9792
github:old-pr/10053
github:old-pr/9784
github:old-pr/9789
github:old-pr/9849
github:old-pr/9846
github:old-pr/9773
github:old-pr/9785
github:old-pr/9803
github:old-pr/9826
github:old-pr/9839
github:old-pr/9922
github:old-pr/9948
github:old-pr/7189
github:old-pr/9957
github:old-pr/9823
github:old-pr/9807
github:old-pr/9851
github:old-pr/9774
github:old-pr/9830
github:old-pr/9836
github:old-pr/9822
github:old-pr/9783
github:old-pr/9833
github:old-pr/9890
github:old-pr/9770
github:old-pr/9769
github:old-pr/9772
github:old-pr/9787
github:old-pr/9852
github:old-pr/9834
github:old-pr/9845
github:old-pr/9871
github:old-pr/9771
github:old-pr/9776
github:old-pr/10005
github:old-pr/9949
github:old-pr/9923
github:old-pr/9805
github:old-pr/9829
github:old-pr/9790
github:old-pr/9827
github:old-pr/9929
github:old-pr/9855
github:old-pr/9934
github:old-pr/9907
github:old-pr/9910
github:old-pr/9779
github:old-pr/9780
github:old-pr/9885
github:old-pr/9882
github:old-pr/9877
github:old-pr/9998
github:old-pr/4251
github:old-pr/9987
github:old-pr/9989
github:old-pr/9950
github:old-pr/9777
github:old-pr/10044
github:old-pr/9884
github:old-pr/2906
github:old-pr/5076
github:old-pr/9937
github:old-pr/9986
github:old-pr/3014
github:old-pr/9943
github:old-pr/9939
github:old-pr/4682
github:old-pr/4765
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
bug
Something isn't working
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
missing claim
Needs a claim in #14
needs rebase
Conflicts with the base branch: rebase it on main
question
Further information is requested
wontfix
This will not be worked on
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
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/ubiquitarianism--leonida!815
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-815"
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?
@kotekompotek on GitHub · 2026-11-24 14:09 UTC · original
kotekompotek:work/d3d12-depth-bounds-test→main· +142 −18 · 13 files · 1 commits · openClaimed in the coordination issue as: D3D-DEPTH-BOUNDS (#14)
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.@abnalstlll-byte on GitHub · 2026-11-24 14:18 UTC · original · approved these changes
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:
eset_state) restores default [0.0f, 1.0f] range on pipeline recycling.
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.
LGTM! Excellent implementation and test coverage. Approved.
@abnalstlll-byte on GitHub · 2026-11-24 14:26 UTC · original · approved these changes
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.
@moffington on GitHub · 2026-11-24 15:37 UTC · original
Reviewed
2f9bee487on RTX 3060 / Linux / Wine 11.20 with Vulkan validation enabled.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:
OMSetDepthBoundsrejects bundle command lists, causingClose()to returnE_INVALIDARG. Microsoft's [command list restrictions](https://learn.microsoft.com/en-us/windows/win32/direct3d12/recording-command-lists-and-bundles#command-list-api-restrictions) explicitly permit this operation in bundles. Could this usedefer(...)likeOMSetStencilRef?Close()to returnE_INVALIDARG, whereas the [OMSetDepthBounds documentation](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist1-omsetdepthbounds) specifies that NaN values silently convert to zero.No draw-time or pipeline-creation Vulkan validation errors observed. Native Windows parity was not tested.
@Sangonapou on GitHub · 2026-11-24 15:45 UTC · original
Tested 2f9bee48 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
scripts\build_runtime.ps1(MSVC 19.51, VS Build Tools 2026, Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0);llvm-mc23.1.6, SPIRV-Tools 2026.4. No game files.d3d12_com,d3d12_mesh,d3d12_vulkan_device(ctest, verbose): all pass, e.g.COM list/queue/fence: 16 colour, depth and stencil texels matchedandDispatchMesh over X, Y and Z and a stream VS draw matched all 4096 pixels.d3d12_meshthe runtime logsdepth-bounds testing needs depthBounds, which the device lacks; enabled 1, i.e. theDepthBoundsTestEnablePSO is refused (d3d12_vulkan_device.cpp:3853,!features.depthBounds). This GPU does support it:vulkaninforeportsdepthBounds = true. So the test passes through its "not supported" branch here and the enabled path (vkCmdSetDepthBounds,OMSetDepthBounds) is never exercised on capable hardware.enable.depthBounds = chosen_features.depthBounds(:9812) is in the standalone device's creation, while the device these tests run on is created withoutdepthBoundsin its enabled features, sodevice_.info.features.depthBoundsstays false. Happy to rerun once that is sorted out.@kotekompotek on GitHub · 2026-11-24 18:07 UTC · original
@moffington @Sangonapou Thanks for the thorough review and WARP/bundle parity findings — addressed in
b3ca7b584: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.d3d12_com_test.cpp,d3d12_bundle_forbidden_test.cpp,d3d12_close_parity_test.cpp, anddocs/d3d12_vulkan.md.D3D-DEPTH-BOUNDSin coordination issue#14: #14Locally verified:
d3d12_com:Passedd3d12_bundle_forbidden:11/11vs host GTX 1050 & WARP (0 failures)d3d12_close_parity: all 5OMSetDepthBoundscases match WARPd3d12_vulkan_devicecompare_feature_options:32 feature queries, 0 mismatchesd3d12_mesh_test.cppcompiled/W4, andtest_ctest_registration.py+test_docs_*.py:OK@QemmHD on GitHub · 2026-11-25 02:08 UTC · original
@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
OMSetDepthBoundsreaching the host list. Before that, those draws passed at every depth. Their note says the first gameplay room is now lit by its lamp for the first time.On
mainthe layer still reportsDepthBoundsTestSupported = FALSEand refuses PSOs that enable it (d3d12_vulkan_device.cpparound 6317/6328, logged byd3d12_xs_pso_stream.cpp), so this PR is on the lighting path. It now conflicts with main (after #984). If you rebase it, I'll test the new head on Windows 11 / MSVC / RTX 4070 SUPER, wheredepthBoundsis supported, so the path Sangonapou couldn't reach on the 3080 Ti Laptop should run here, and I'll post the results.AI-assisted (Claude Code, Claude Opus 5.5).
@QemmHD on GitHub · 2026-11-25 03:12 UTC · original · edited 2026-11-25 04:27 UTC
Retail data point for this PR: on main
3ff2a2adc(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).
@kotekompotek on GitHub · 2026-11-25 06:39 UTC · original
Rebased onto current
main(42537e7b6) asefea97331— the conflict after #984 is resolved. The head now carries both sides:multiViewport+VK_DYNAMIC_STATE_*_WITH_COUNTand the stencil per-face masks frommain, plus this PR'sdepthBoundsfeature gate,VK_DYNAMIC_STATE_DEPTH_BOUNDSandOMSetDepthBoundson direct lists and bundles.create_graphicsnow takes both the stream'sStencilFaceMasksand the newGraphicsStreamExtras(depth-bounds flag), so a DEPTH_STENCIL1/2 stream no longer refusesDepthBoundsTestEnable— it is refused only when the device lacksVkPhysicalDeviceFeatures::depthBounds.Verified locally on Windows / MSVC Debug (GTX 1050, driver 582.28):
pso_stream,d3d12_com,d3d12_d24_supportpass;d3d12_vulkan_deviceandd3d12_close_paritybuild clean and show the same two pre-existingmainfailures on this machine (theCreateHeapinvalid-argument column on the GTX 1050 and the threeCopyTextureRegionWARP-annotation rows — unrelated to this change).d3d12_mesh_testis not built here (noglslangValidator).The head is ready for your RTX 4070 SUPER run —
depthBoundsis enabled there, so the 224-refusal path you logged should now take the hardware test.AI-assisted.
@djrolfes on GitHub · 2026-11-25 07:34 UTC · original
Independent integration review while preparing an RTX 3070 Ti / Linux Wine test of exact efea97331 on main
42537e7b6(+ 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.
@QemmHD on GitHub · 2026-11-25 07:46 UTC · original
Real-boot A/B of this PR at efea97331 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.
c7e82e26e,CheckFeatureSupport(OPTIONS2)still reports DepthBoundsTestSupported = FALSE, andCreatePipelineStaterefuses every stream with the depth-bounds test on ("depth-bounds tests are not supported yet; stream subobject 21"): 225 refusals per boot, 3 of 3 runs. They only disappear when the slot 57 factory builds those pipelines instead, opaque, which is the picture regression on #939.OMSetDepthBoundscall appears before that stop, so the dynamic bounds stay at their defaults in this phase, and the screens that would use these pipelines visibly aren't reached yet. So this confirms it works and causes no regression, not a visual result.AI-assisted (Claude Code, Claude Opus 5.5).
@thiefyzheng on GitHub · 2026-11-25 08:33 UTC · original
@djrolfes — picked up your finding as RT-DEPTHBOUNDS-STREAM-EXTRAS (claimed on #1608): #1695, branched from this PR's head
efea9733andDepends on: #815. It passesstream.back_masks?&stream.back_stencil:nullptr, &stream.extrasat theresolve_typecall site, and mixes those fields into the console path's pipeline cache key (prepare_console_streamhashed only the plainD3D12_DEPTH_STENCIL_DESC, so two console PSOs differing only in depth bounds — or back-face masks — collided). A regression test ind3d12_mesh_testdraws a DEPTH_STENCIL1DepthBoundsTestEnablestream through the lazy path insideOMSetDepthBounds(0,1)/(0.5,1).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.
@kotekompotek on GitHub · 2026-11-25 09:40 UTC · original
Status at
efea97331: the two conformance gaps @moffington reported are both in —OMSetDepthBoundsrecords throughdefer(...)so bundles accept it, and NaN/out-of-range bounds are accepted at record time and clamped inside Vulkan's 0..1 domain at replay (d3d12_com.cpp:929comment covers both). Thanks @QemmHD for the 225-refusals A/B on the RTX 4070 SUPER and @Sangonapou for the 3080 Ti run — the "depthBounds not enabled on the test device" path is real, it's why the enabled branch only shows on capable hardware.@thiefyzheng thanks for picking up @djrolfes's console-stream finding. I'd keep #1695 stacked with
Depends on: #815rather than folding it in: this head is what @QemmHD just A/B-tested, and a stacked PR keeps the cache-key/extras fix reviewable on its own. If a maintainer would rather have one PR I'll fold it in.@kotekompotek on GitHub · 2026-11-25 14:24 UTC · original
Rebased onto current main (
71a769d7d, post-#1671/#1691/#1703) —a635392c6. One conflict ind3d12_com.cpprecord_mesh_draw: kept both the newmin/max_depth_bounds_Draw fields and main'snote_direct_heap_indexing(graphics_.layout).Local run on this box (GTX 1050, driver 582.28, Windows 11, Debug):
d3d12_comPASS. Two failures in the run are baseline-on-this-host, not this change:d3d12_vulkan_deviceheap_mismatches: this host's D3D12 runtime refuses every CreateHeap — handled by #1721.d3d12_close_parity: threeCopyTextureRegion uploadrows (offset 16, offset 4, row pitch 260) markedstricternow match WARP on current main — main's own table entries, my diff only adds the fiveOMSetDepthBoundscases (all match WARP, incl. NaN and out-of-range).@djrolfes the conflict was mechanical; your lazy-path finding is covered separately by @thiefyzheng's #1695 stacked on this PR.
github-bot referenced this pull request2026-11-26 11:24:02 +00:00
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.