d3d12: realize console streams with their depth-bounds flag and back-face stencil masks (RT-DEPTHBOUNDS-STREAM-EXTRAS) #1695
Open
github-bot
wants to merge 3 commits from
github-bot/gh-1695 into main
AGit
pull from: github-bot/gh-1695
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!1695
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1695"
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?
@thiefyzheng on GitHub · 2026-11-25 08:33 UTC · original
thiefyzheng:fix/depthbounds-stream-extras→main· +259 −21 · 13 files · 3 commits · openRT-DEPTHBOUNDS-STREAM-EXTRAS — Depends on: #815
Claimed on #1608 (#1608). This fixes @djrolfes' integration finding on #815 (#815). @kotekompotek: happy to have this folded into #815 instead of a stacked PR — say so and I'll drop it.
Note: the diff includes #815's commit until it merges, since this branches from its head
efea97331.What
PipelineState::resolve_type'sstd::call_onceblock (runtime/shims/d3d12_vulkan_device.cpp:7059) realized a console stream withcreate_graphics(stream.graphics, &stream.ms, &stream.as), silently droppingstream.extras(the depth-bounds flag, #815'sGraphicsStreamExtras) andstream.back_stencil(DEPTH_STENCIL2 back-face masks, whichparse_pipeline_streamfills right next to the front ones). The eagerCreatePipelineStatebranch passes both. It now passesstream.back_masks?&stream.back_stencil:nullptrand&stream.extras— argument-for-argument identical to the eager call at ~12104.prepare_console_stream(~10367) set the pipeline cache key frompipeline_key(stream.graphics)alone; the plainD3D12_DEPTH_STENCIL_DESCthe key hashes cannot see the depth-bounds flag or back-face masks, so two console PSOs differing only in those would collide. The key now post-mixesback_masks,back_stencil.read/.writeandextras.depth_bounds_testwith the samecached_pso::KeyBuilder/sha256_hexidiompipeline_keyitself uses.runtime/test/d3d12_mesh_test.cpp: a console stream (device slot 86, mesh-shader subobject 24) carrying DEPTH_STENCIL1 withDepthBoundsTestEnableand a D32_FLOAT DSV, drawn once insideOMSetDepthBounds(0, 1)(red — depth 0 is inside) and once insideOMSetDepthBounds(0.5, 1)(blue — the discard only happens if the flag reached the pipeline). Without the source fix both draws come out red.What was run
create_graphicssignature match (7119–7123), thePipelineStreamfields and their parse fill, every identifier the test uses in scope with types lined up, fence values (the newbounds_fencepre-increments from 3, first Signal is 4 — no collision with the earlier Signals 1–3), the readback footprint/offset parity with the file's existing usage, slot 86 = consoleCreatePipelineState, and subobject 24 = the console mesh shader (consistent with the existing stream test at line 341 and the console→PC remap ind3d12_xs_pso_stream.h:31). That review caught two real defects, both fixed here: the test's second-frame depth barrier indicated a COMMON→DEPTH_WRITE transition from a buffer already in DEPTH_WRITE (now conditional onfirst_frame), and the cache-key collision above.d3d12_mesh_testwith the one-line source change reverted and show the bounds case fails) needs a depth-bounds-capable Vulkan device, which the author host does not have. The test skips cleanly whenDepthBoundsTestSupportedis FALSE or inpc_onlybuilds.Attribution
AI-assisted: implementation (Claude Sonnet 5.5 worker), independent review and follow-up fixes (GLM 5.3 Flash worker), orchestration and verification by the contributor. No game files were used or are needed; no game data in this PR.
@kawaii-shakal on GitHub · 2026-11-25 09:45 UTC · original · reviewed
Review (read-only, not run). The pipeline-cache key now including the back-face masks and the depth-bounds flag is an important catch, and the plumbing through
OMSetDepthBounds, bundles andDrawlooks complete. Three points:vulkan_replay.h,d3d12_com.cppand the device; please get at least a build andd3d12_mesh_testfrom someone with a depthBounds-capable GPU before merge. I can run it on an RTX 5070 Ti if it helps.enable.depthBounds = chosen_features.depthBoundsis added increate_vulkan_device_standalone.DepthBoundsTestSupportedand the PSO check readstate_.info.features.depthBounds. When the device comes from the runtime's own creation path (not standalone), isinfo.featuresthe enabled set or the supported set? If it is the supported set, a PSO could enabledepthBoundsTestEnableon a device that never enabled the feature (a VUID).dyn_list[9]: with #778 (addsVK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXTto the same list) the maximum becomes 7 + 1 + 1 = 9, so 9 is exactly enough. Astatic_assertor a comment counting the entries would keep the next addition from overflowing it.AI-assisted review (Claude Code, Claude Opus 5.5).
@potatoe0100 on GitHub · 2026-11-25 11:18 UTC · original
Tested
766c6c42emerged ontomainbcaa13dad(clean), native Windows 11 Pro 26H2 (build 26300), NVIDIA GeForce RTX 4060 (depthBounds and mesh shaders supported), driver 621.14, VS 2022 RelWithDebInfo + Ninja.ctest -j 6: 409 of 409 passed, same asmain; that includesd3d12_mesh,d3d12_bundle_forbidden,d3d12_close_parity,d3d12_comandd3d12_vulkan_device.d3d12_mesh_testwithLEONIDA_VK_VALIDATION=1: exit 0, 0 VUIDs, "DispatchMesh over X, Y and Z and a stream VS draw matched all 4096 pixels".run_gpu_tests.py: 209/263 passed, 53 skipped, identical tomain.AI-assisted testing (non-developer tester).
@adrianmjim on GitHub · 2026-11-25 11:24 UTC · original
Tested
766c6c42eapplied ontomain42537e7b6on AMD: Radeon RX 7900 XT (RDNA3,depthBounds = true), AMD driver 32.0.32029.2010 (26.11.2), Windows 11 build 26300, VS 2022 RelWithDebInfo. No game files.Tests:
LEONIDA_VK_VALIDATION=1(no messages):d3d12_mesh,d3d12_com,d3d12_close_parity,d3d12_bundle_forbidden,d3d12_vulkan_device,pso_stream,d3d12_draw,d3d12_pso_validation,d3d12_depth24_draw,d3d12_geometry,d3d12_multi_viewport,d3d12_rect_list,d3d12_quad_index,d3d12_translated_draw.ctest -j 6: 399 of 402, with the same three failures asmain.Three things in the code:
1.
OMSetDepthBoundswith a NaN. The D3D12 reference says of bothMinandMax: "NaN values silently convert to 0". At replay the PR makes any NaN an empty range ((mn != mn) || (mx != mx)→set_depth_bounds(1, 0)), so every pixel is discarded.OMSetDepthBounds(NaN, 0.5)should test[0, 0.5].(0.2, NaN)happens to come out right, because D3D12's[0.2, 0]is empty too. Mapping NaN to 0 first and then applying the existing clamp/empty rules would match D3D12.2. The extra cache-key mix is dropped.
pipeline->set_cache_key(pipeline_key(stream.graphics) + leonida::sha256_hex(extra.data()))appends a second 64-character hash to a key that is already a 64-charactersha256_hex.cached_pso::encode()/check()dopadded.resize(key_bytes)withkey_bytes = 64, so the back-face masks and the depth-bounds flag never reach the cached blob. So two console streams that differ only in those return byte-identicalGetCachedBlobblobs, and the mix has no effect. Hashing the two parts together, for example by feedingextra's bytes into the sameKeyBuilderbefore thesha256_hex, would keep the key at 64 characters.3. The new
d3d12_meshcase doesn't go through the newresolve_typepath. ctest runs it withoutLEONIDA_PIPELINE_COMPILE=on-demand, so slot 86 goes to the eagerCreatePipelineStatepath, which this PR also changes to pass&stream.extras. The test would pass without theresolve_typechange.I tried it with
LEONIDA_PIPELINE_COMPILE=on-demand.d3d12_meshthen fails, but it fails the same way onmainwithout this PR: the console stream from slot 86 isn't created (SUCCEEDED(console_hr) && console_pso.p, line 353 with the PR, line 344 onmain). So the test can't cover the on-demand path at the moment. That failure is separate and predates this PR.@thiefyzheng on GitHub · 2026-11-25 11:28 UTC · original
@adrianmjim — thank you for the 7900 XT run and the three review points. Both code findings are fixed in
6f710e57(a fast-forward on the tested766c6c42, so your results still describe the base):1. Cache-key mix truncated away — fixed.
cached_psoresizing the key to 64 chars means the appended second hash never reached the blob.pipeline_key(graphics overload) now takes an optionalconst KeyBuilder* extrahashed into the same builder before its singlesha256_hex;prepare_console_streampasses the back-masks/back-stencil/depth-bounds builder. All otherpipeline_keycall sites keep byte-identical keys (defaultnullptr, no bytes appended): the trace print at ~7285, the compute overload at ~10371,shared_native_graphicsat ~10388,CreateComputePipelineStateat ~11967,CreateGraphicsPipelineStateat ~11984 (eagerCreatePipelineStatedoesn't callpipeline_keyat all).2. NaN depth bounds — fixed on this branch, with a note for @kotekompotek. Replay now maps NaN to 0 first (
vulkan_replay.h~4893), then the existing clamp/inverted-is-empty rules unchanged — so(NaN, 0.5)behaves as[0, 0.5]and(0.2, NaN)as[0.2, 0](empty). Record-time acceptance and bundles are untouched. This is replay-side code that came in with #815; kotekompotek, if you would rather carry it in #815 itself, say so and I'll drop the hunk here and rebase on your fix.3. Test covers only the eager slot-86 path — acknowledged. Under plain ctest
LEONIDA_PIPELINE_COMPILEisn't on-demand, soCreatePipelineState(~12090-12122, eagercreate_graphicsat 12118) is what the mesh case exercises; theresolve_typelazy realization at ~7055/7063 is not covered, because on-demand mode fails earlier — console stream from slot 86 not created (the SUCCEEDED(console_hr) bail atd3d12_mesh_test.cpp:349/~353), identically onmain. I have not touched that pre-existing failure; the case still guards the eager path plus the replay-side bounds, and theresolve_typechange remains a code-path-observation fix for now.New commit is again not compiled and not GPU-confirmed on the author host (no Vulkan SDK / MSVC here); it needs one more hardware look like yours when convenient.
@adrianmjim on GitHub · 2026-11-25 12:48 UTC · original
Rechecked
6f710e574on the RX 7900 XT (driver 32.0.32029.2010, Windows 11 26300, VS 2022 RelWithDebInfo). Both points are fixed:KeyBuilder, so the key stays one 64-character hash.OMSetDepthBounds(NaN, 0.5)is in the state sweep and gives the same result as host D3D12 here (0x00000000 | 0x00000000 | match).The 14 related tests pass with
LEONIDA_VK_VALIDATION=1and no VUIDs. Wholectest -j 6: 398 of 402 pass or skip. The failures ared3d12_texture_tiles,d3d12_clearandd3d12_geometry_views, which fail onmainhere too, plusd3d12_api_descriptor_copy, which failed once under-j 6and passes 3 of 3 alone.@thiefyzheng on GitHub · 2026-11-25 12:52 UTC · original
@adrianmjim — thank you for the recheck on
6f710e57. Recording the state for whoever merges: the head now carries an independent hardware verification on RDNA3 covering all three of your original points (single 64-char key, NaN→0 matching host D3D12, eager-path suite green withLEONIDA_VK_VALIDATION=1, 0 VUIDs), with the only ctest failures being the three pre-existingmainbaseline ones plus one-j 6flake that passes alone.Open item unchanged: @kotekompotek, whether the NaN hunk stays here or you carry it in #815 — the default assumed here is that it stays unless you'd rather have it; a maintainer can also drop it at merge. Everything else on this PR is reviewer-verified. AI-assisted.
@thiefyzheng on GitHub · 2026-11-25 14:26 UTC · original
Rebased onto #815's new head
a635392c6(post its71a769d7drebase) — our two commits are now6b7bf490andbb8e1131, conflict-free (this PR never touchesd3d12_com.cpp, where #815's own conflict was). The commit contents are unchanged from the previously verified766c6c42/6f710e57, so the hardware receipts above (RTX 4060 full suite, RX 7900 XT recheck of both review fixes) carry over modulo the new base; one more spot-check on the new head is welcome when convenient — @potatoe0100, @adrianmjim, either of you has the fastest boots for this.The NaN hunk stays in this branch as agreed default unless @kotekompotek moves it into #815 — say the word and I'll drop it here. AI-assisted (orchestrator).
@MoonEyes on GitHub · 2026-11-25 18:15 UTC · original
Ran #1695 at head
bb8e11314on a depth-bounds-capable GPU.Config: Windows 11 (26300), RTX 4060 desktop, NVIDIA 610.88 (
depthBounds= true), MSVC 19.44, RelWithDebInfo, Vulkan SDK 1.4.363.0. Test targets only, no game files.d3d12_mesh_test,d3d12_vulkan_device_test,d3d12_com_test,d3d12_close_parity_test,d3d12_bundle_forbidden_test(0 errors).ctest:d3d12_mesh,d3d12_vulkan_device,d3d12_com,d3d12_close_parity,d3d12_bundle_forbiddenall pass. The new depth-bounds case does run here (not skipped): red insideOMSetDepthBounds(0, 1), clear blue inside(0.5, 1).resolve_typeline put back tocreate_graphics(stream.graphics,&stream.ms,&stream.as)andd3d12_mesh_testrebuilt, the test still passes. So under plain ctest the new case does not catch the dropped flag; slot 86 takes the eager path, as in your finding 7161103050.LEONIDA_PIPELINE_COMPILE=on-demand: fails atline 353: SUCCEEDED(console_hr) && console_pso.p, the same with and without the fix, before the depth-bounds case. That is consistent with 7161103050 on NVIDIA (I compared the PR head with and without the fix line, not main).So: it compiles and nothing regresses in these 5 tests, but the lazy-path fix itself is not exercised by any test I ran. Not covered: full runtime build, full ctest, AMD/Intel.
AI-assisted: yes (Claude Code ran the tests)
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.