RT-STATE-AUDIT-FORMATS: honor D3D12_DSV_FLAG_READ_ONLY_DEPTH and READ_ONLY_STENCIL #2480
Closed
lixonik wants to merge 10 commits from
upstream-pr/2480 into main
pull from: upstream-pr/2480
merge into: ProjectLeonida:main
ProjectLeonida:main
ProjectLeonida:claude/loop-total
ProjectLeonida:claude/pops-collision-seed
ProjectLeonida:claude/dstorage-hold-page-reads
ProjectLeonida:claude/host-image-copy-switch
ProjectLeonida:feat/gdk-lifecycle-window-hook
ProjectLeonida:claude/d16s8-uav-nvidia-fallback
ProjectLeonida:feat/mfplat-offline-shim
ProjectLeonida:claude/gameinput-slow-reader
ProjectLeonida:fix/rt-null-barrier-clear
ProjectLeonida:claude/depth-resolve-sample-positions
ProjectLeonida:integration/palmetto-parity
ProjectLeonida:claude/valu-literal-sext
ProjectLeonida:claude/slot74-pool-handle
ProjectLeonida:claude/rgb9e5-uint-alias-view
ProjectLeonida:claude/fssm-root-layout-tables
ProjectLeonida:feat/gdk-speech-display-lifecycle
ProjectLeonida:asset-audio-skip-current
ProjectLeonida:qemmhd/old-9940-rectangle-quad-lists
ProjectLeonida:feat/ws2-offline-shim
ProjectLeonida:qemmhd/rt-d16-unorm-uav
ProjectLeonida:feat/xs-device-stops-7-9
ProjectLeonida:qemmhd/rt-depth-same-base-shapes
ProjectLeonida:qemmhd/rt-lazy-attachment-variant
ProjectLeonida:feat/acphal-xma2-decoder
ProjectLeonida:asset-audio-skip
ProjectLeonida:codex/coord-claim-check-20261124-7e48
ProjectLeonida:feat/xs-frame-pacing-presentx
ProjectLeonida:feat/xs-device-vm-options
ProjectLeonida:old-pr/9844
ProjectLeonida:old-pr/9978
ProjectLeonida:old-pr/9815
ProjectLeonida:old-pr/10057
ProjectLeonida:old-pr/9874
ProjectLeonida:old-pr/9965
ProjectLeonida:old-pr/9863
ProjectLeonida:old-pr/10068
ProjectLeonida:old-pr/10066
ProjectLeonida:old-pr/10067
ProjectLeonida:old-pr/10007
ProjectLeonida:old-pr/10061
ProjectLeonida:old-pr/10065
ProjectLeonida:old-pr/10059
ProjectLeonida:old-pr/10063
ProjectLeonida:old-pr/10055
ProjectLeonida:old-pr/10062
ProjectLeonida:old-pr/10042
ProjectLeonida:old-pr/10041
ProjectLeonida:old-pr/10049
ProjectLeonida:old-pr/10047
ProjectLeonida:old-pr/10046
ProjectLeonida:old-pr/10045
ProjectLeonida:old-pr/10056
ProjectLeonida:old-pr/10043
ProjectLeonida:old-pr/10036
ProjectLeonida:old-pr/10034
ProjectLeonida:old-pr/9984
ProjectLeonida:old-pr/10052
ProjectLeonida:old-pr/10038
ProjectLeonida:old-pr/10033
ProjectLeonida:old-pr/10028
ProjectLeonida:old-pr/10050
ProjectLeonida:old-pr/9891
ProjectLeonida:old-pr/9889
ProjectLeonida:old-pr/10051
ProjectLeonida:old-pr/10019
ProjectLeonida:old-pr/10027
ProjectLeonida:old-pr/10029
ProjectLeonida:old-pr/10031
ProjectLeonida:old-pr/10026
ProjectLeonida:old-pr/9941
ProjectLeonida:old-pr/10030
ProjectLeonida:old-pr/10040
ProjectLeonida:old-pr/9990
ProjectLeonida:old-pr/10021
ProjectLeonida:old-pr/9962
ProjectLeonida:old-pr/10022
ProjectLeonida:old-pr/10020
ProjectLeonida:old-pr/10015
ProjectLeonida:old-pr/10025
ProjectLeonida:old-pr/9886
ProjectLeonida:old-pr/10048
ProjectLeonida:old-pr/10014
ProjectLeonida:old-pr/10011
ProjectLeonida:old-pr/9861
ProjectLeonida:old-pr/10010
ProjectLeonida:old-pr/10008
ProjectLeonida:old-pr/9860
ProjectLeonida:old-pr/10006
ProjectLeonida:old-pr/9920
ProjectLeonida:old-pr/9995
ProjectLeonida:old-pr/10000
ProjectLeonida:old-pr/10016
ProjectLeonida:old-pr/10004
ProjectLeonida:old-pr/10023
ProjectLeonida:old-pr/9982
ProjectLeonida:old-pr/9981
ProjectLeonida:old-pr/9983
ProjectLeonida:old-pr/9970
ProjectLeonida:old-pr/9969
ProjectLeonida:old-pr/9968
ProjectLeonida:old-pr/9971
ProjectLeonida:old-pr/9972
ProjectLeonida:old-pr/9942
ProjectLeonida:old-pr/9963
ProjectLeonida:old-pr/9960
ProjectLeonida:old-pr/9964
ProjectLeonida:old-pr/9985
ProjectLeonida:old-pr/9973
ProjectLeonida:old-pr/9862
ProjectLeonida:old-pr/9953
ProjectLeonida:old-pr/10017
ProjectLeonida:old-pr/9952
ProjectLeonida:old-pr/9955
ProjectLeonida:old-pr/9946
ProjectLeonida:old-pr/9954
ProjectLeonida:old-pr/9938
ProjectLeonida:old-pr/9956
ProjectLeonida:old-pr/9856
ProjectLeonida:old-pr/9947
ProjectLeonida:old-pr/9924
ProjectLeonida:old-pr/9961
ProjectLeonida:old-pr/9927
ProjectLeonida:old-pr/9979
ProjectLeonida:old-pr/10032
ProjectLeonida:old-pr/9926
ProjectLeonida:old-pr/5237
ProjectLeonida:old-pr/9951
ProjectLeonida:old-pr/9931
ProjectLeonida:old-pr/9902
ProjectLeonida:old-pr/9921
ProjectLeonida:old-pr/9994
ProjectLeonida:old-pr/9775
ProjectLeonida:old-pr/9768
ProjectLeonida:old-pr/9905
ProjectLeonida:old-pr/9936
ProjectLeonida:old-pr/9901
ProjectLeonida:old-pr/9904
ProjectLeonida:old-pr/9906
ProjectLeonida:old-pr/9988
ProjectLeonida:old-pr/9908
ProjectLeonida:old-pr/9909
ProjectLeonida:old-pr/9911
ProjectLeonida:old-pr/9912
ProjectLeonida:old-pr/9913
ProjectLeonida:old-pr/9887
ProjectLeonida:old-pr/9916
ProjectLeonida:old-pr/9919
ProjectLeonida:old-pr/9925
ProjectLeonida:old-pr/9933
ProjectLeonida:old-pr/9935
ProjectLeonida:old-pr/9918
ProjectLeonida:old-pr/9879
ProjectLeonida:old-pr/9880
ProjectLeonida:old-pr/9881
ProjectLeonida:old-pr/9996
ProjectLeonida:old-pr/9876
ProjectLeonida:old-pr/9892
ProjectLeonida:old-pr/9899
ProjectLeonida:old-pr/9915
ProjectLeonida:old-pr/9914
ProjectLeonida:old-pr/9872
ProjectLeonida:old-pr/9869
ProjectLeonida:old-pr/9866
ProjectLeonida:old-pr/9819
ProjectLeonida:old-pr/10012
ProjectLeonida:old-pr/9857
ProjectLeonida:old-pr/9893
ProjectLeonida:old-pr/9897
ProjectLeonida:old-pr/9928
ProjectLeonida:old-pr/9868
ProjectLeonida:old-pr/9917
ProjectLeonida:old-pr/9940
ProjectLeonida:old-pr/9873
ProjectLeonida:old-pr/9816
ProjectLeonida:old-pr/10009
ProjectLeonida:old-pr/9900
ProjectLeonida:old-pr/9966
ProjectLeonida:old-pr/9859
ProjectLeonida:old-pr/9843
ProjectLeonida:old-pr/9991
ProjectLeonida:old-pr/10058
ProjectLeonida:old-pr/9883
ProjectLeonida:old-pr/9838
ProjectLeonida:old-pr/9835
ProjectLeonida:old-pr/9959
ProjectLeonida:old-pr/9895
ProjectLeonida:old-pr/9837
ProjectLeonida:old-pr/9858
ProjectLeonida:old-pr/9865
ProjectLeonida:old-pr/9864
ProjectLeonida:old-pr/9840
ProjectLeonida:old-pr/9820
ProjectLeonida:old-pr/4669
ProjectLeonida:old-pr/9848
ProjectLeonida:old-pr/9850
ProjectLeonida:old-pr/9810
ProjectLeonida:old-pr/9799
ProjectLeonida:old-pr/9853
ProjectLeonida:old-pr/9875
ProjectLeonida:old-pr/9831
ProjectLeonida:old-pr/9796
ProjectLeonida:old-pr/9801
ProjectLeonida:old-pr/9813
ProjectLeonida:old-pr/9794
ProjectLeonida:old-pr/7417
ProjectLeonida:old-pr/9781
ProjectLeonida:old-pr/9806
ProjectLeonida:old-pr/9958
ProjectLeonida:old-pr/9809
ProjectLeonida:old-pr/9791
ProjectLeonida:old-pr/9792
ProjectLeonida:old-pr/10053
ProjectLeonida:old-pr/9784
ProjectLeonida:old-pr/9789
ProjectLeonida:old-pr/9849
ProjectLeonida:old-pr/9846
ProjectLeonida:old-pr/9773
ProjectLeonida:old-pr/9785
ProjectLeonida:old-pr/9803
ProjectLeonida:old-pr/9826
ProjectLeonida:old-pr/9839
ProjectLeonida:old-pr/9922
ProjectLeonida:old-pr/9948
ProjectLeonida:old-pr/7189
ProjectLeonida:old-pr/9957
ProjectLeonida:old-pr/9823
ProjectLeonida:old-pr/9807
ProjectLeonida:old-pr/9851
ProjectLeonida:old-pr/9774
ProjectLeonida:old-pr/9830
ProjectLeonida:old-pr/9836
ProjectLeonida:old-pr/9822
ProjectLeonida:old-pr/9783
ProjectLeonida:old-pr/9833
ProjectLeonida:old-pr/9890
ProjectLeonida:old-pr/9770
ProjectLeonida:old-pr/9769
ProjectLeonida:old-pr/9772
ProjectLeonida:old-pr/9787
ProjectLeonida:old-pr/9852
ProjectLeonida:old-pr/9834
ProjectLeonida:old-pr/9845
ProjectLeonida:old-pr/9871
ProjectLeonida:old-pr/9771
ProjectLeonida:old-pr/9776
ProjectLeonida:old-pr/10005
ProjectLeonida:old-pr/9949
ProjectLeonida:old-pr/9923
ProjectLeonida:old-pr/9805
ProjectLeonida:old-pr/9829
ProjectLeonida:old-pr/9790
ProjectLeonida:old-pr/9827
ProjectLeonida:old-pr/9929
ProjectLeonida:old-pr/9855
ProjectLeonida:old-pr/9934
ProjectLeonida:old-pr/9907
ProjectLeonida:old-pr/9910
ProjectLeonida:old-pr/9779
ProjectLeonida:old-pr/9780
ProjectLeonida:old-pr/9885
ProjectLeonida:old-pr/9882
ProjectLeonida:old-pr/9877
ProjectLeonida:old-pr/9998
ProjectLeonida:old-pr/4251
ProjectLeonida:old-pr/9987
ProjectLeonida:old-pr/9989
ProjectLeonida:old-pr/9950
ProjectLeonida:old-pr/9777
ProjectLeonida:old-pr/10044
ProjectLeonida:old-pr/9884
ProjectLeonida:old-pr/2906
ProjectLeonida:old-pr/5076
ProjectLeonida:old-pr/9937
ProjectLeonida:old-pr/9986
ProjectLeonida:old-pr/3014
ProjectLeonida:old-pr/9943
ProjectLeonida:old-pr/9939
ProjectLeonida:old-pr/4682
ProjectLeonida:old-pr/4765
No reviewers
Labels
Clear labels
No items
No labels
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.
Reference
ProjectLeonida/mandy!2480
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2480"
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 lixonik on 2026-11-27T16:31:10Z.
Part of
RT-STATE-AUDIT-FORMATS(#2464; based on the format-state audit notes in #1608 by@kevincommitsand@Tauwni).Summary
dsv_read_only_depth,dsv_read_only_stencil) onTargetView(runtime/src/command_list.h;sizeof(TargetView) == 32 <= kDescriptorSize).desc->FlagsinCreateDepthStencilView(runtime/shims/d3d12_vulkan_device.cpp), rejecting unknown flag bits and recordingD3D12_DSV_FLAG_READ_ONLY_DEPTH/D3D12_DSV_FLAG_READ_ONLY_STENCIL.runtime/src/vulkan_replay.h:VkRenderingAttachmentInfofor depth and stencil withVK_ATTACHMENT_STORE_OP_NONE, read-only access masks (VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT), and per-aspect read-only layouts whenseparate_depth_stencil_layoutsis enabled (orDEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL/DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMALwhen coupled).VK_IMAGE_LAYOUT_GENERALfor read-only depth/stencil with bindless sampling where the Vulkan attachment access rules allow it. Simultaneous sampling of one aspect of a packed depth/stencil image while storing the sibling on devices withoutseparateDepthStencilAttachmentAccessremains open. When the sampled aspect entered the draw in GENERAL, replay restores that layout for subsequent reads after the attachment scope ends. See the review.ClearDepthStencil.GraphicsPipeline::read_only_depth/read_only_stencilvariant bits (runtime/src/vulkan_replay.h,runtime/shims/d3d12_vulkan_device.cpp) so pipelines withDepthWriteMask = ALLor nonzero stencil write masks suppress writes cleanly when drawn against a read-only DSV (no variant is built when the PSO already disables writes).Tests
runtime/test/d3d12_dsv_readonly_test.cpp(d3d12_dsv_readonly, skips with 77 if no Vulkan GPU): exercises unknown-flag rejection, mixedREAD_ONLY_DEPTH+ writable stencil, mixed writable depth +READ_ONLY_STENCIL,READ_ONLY_DEPTH | READ_ONLY_STENCIL, read-onlyClearDepthStencilViewmasking, andD32_FLOATREAD_ONLY_DEPTHon GPU.runtime/test/dsv_readonly_replay_test.cpp(dsv_readonly_replay, CPU-only, no GPU required): verifies attachment layouts,storeOp, barrier access masks,separate_depth_stencil_layoutstrue/false,sampled_in_general, write-suppression variant requests, andClearDepthStencilread-only skipping.Negative control & verification
main(ec91d695c),d3d12_dsv_readonly_testfailed all 6 GPU checks on RTX 5070 (unknown flag0x4accepted,READ_ONLY_DEPTHoverwrote depth to0x400000causing the second draw to fail depth test,READ_ONLY_STENCILandREAD_ONLY_BOTHmodified depth/stencil, partial clear overwrote read-only depth, andD32_FLOATREAD_ONLY_DEPTHoverwrote0.75with0.25).ctest -R "^(dsv_readonly_replay|d3d12_dsv_readonly|d3d12_state_map|vk_command_replay|d3d12_depth24_draw|d3d12_typeless_depth)$": 6/6 passed.python scripts/check_no_game_data.py: clean.python -m unittest tests/test_ctest_registration.py: 6/6 OK.git diff --check: clean.GPUs tested: NVIDIA GeForce RTX 5070 (Windows 11, native Vulkan;
VK_LAYER_KHRONOS_validationnot installed locally).AI-assisted.
Independent Vulkan validation on RTX 3080: four synthetic DSV tests passed, including the precise-occlusion assertion. That run covers the D32 control. Test report.
Follow-up after merging main
At
c6fabd3395withmainbd643e46e7, both sides' CMake test registrations are present. On Windows 10 22H2, RTX 5070 (610.88), MSVC 19.44 and Khronos validation, all four selected tests passed:dsv_readonly_replay,d3d12_dsv_readonly,depth24_cpu, andd3d12_depth24_draw. The same-draw packed depth/stencil case described above remains open.Independent native Linux GPU follow-up at
c6fabd339on RADV and NVIDIA confirmed that the post-render transition restores shader reads inGENERAL. All eight mixed draws and eight sample-only controls returned the expected pixels with synchronization validation enabled. Removing only the restoration triggered a descriptor/image layout validation error in all eight recordings. Test reportImported from ubiquitarianism/leonida. Originally posted by djrolfes on 2026-11-27T17:15:00Z.
Independent Linux/Wine + NVIDIA check at head
86b890ca1(merged cleanly ontoorigin/mainc0201a806alongside#2478,#2477,#2476,#2474).7.2.15,wine-11.22,clang-cl+xwincross-build, NVIDIA GeForce RTX 3070 Ti 8 GB, driver620.73.04, Ryzen 7 5800X, 32 GB RAM. No game files.d3d12_dsv_readonly: passed (6.06 s) on RTX 3070 Ti under Wine.dsv_readonly_replay: passed (4.42 s) under Wine.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-27T19:53:29Z.
Tested for #2464 as Aslanek asked: unit tests and a game run on my machine; CI ignored for now as asked.
Reading (marked):
Limits: one machine, one run for the PR, one run for the main witness.
AI-assisted (Claude Code, Claude Opus 5.5)
Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-28T01:33:45Z.
Reviewed at head
86b890ca1on Windows 11 (MSVC 202219.44) with dual-GPU Vulkan validation (LEONIDA_VK_VALIDATION=1, Vulkan SDK1.4.363.0).Verification
dsv_readonly_replay_test,d3d12_dsv_readonly_test,d3d12_depth24_draw_test, andgta6rt.dsv_readonly_replay_test: passed (8/8 checks).d3d12_dsv_readonly_test(LEONIDA_VK_VALIDATION=1): passed with 0 validation errors on both NVIDIA GeForce RTX 5080 (616.64) and AMD Radeon(TM) Graphics (25.10.30.02).d3d12_depth24_draw_test(LEONIDA_VK_VALIDATION=1): passed on both RTX 5080 and AMD Radeon (0 validation errors).Findings (Request changes)
VK_IMAGE_LAYOUT_GENERAL(vulkan_replay.h:5592-5601,3046-3059):On the normal bindless path (
sampled_in_general),image_layout()mapsDEPTH_STENCIL_READ_ONLY_OPTIMALand the mixed read-only layouts toVK_IMAGE_LAYOUT_GENERAL.detail::to_attachment()emits the layout transition withdstAccessMasklimited toVK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT(ordepth_access) anddstStageMasklimited toEARLY_FRAGMENT_TESTS | LATE_FRAGMENT_TESTS. If a resource is already inD3D12_RESOURCE_STATE_DEPTH_READ | NON_PIXEL_SHADER_RESOURCE(orPIXEL_SHADER_RESOURCE) and transitions from attachment layout toGENERALat draw time without an intervening D3D12 barrier, a shader sampling the read-only depth/stencil in that draw (e.g., vertex/mesh/fragment) is outside the barrier's destination scope. The coupled-plane fallback (separate == false,vulkan_replay.h:1738-1742) has the same destination scope gap. Please includeVK_ACCESS_SHADER_READ_BITand the consuming shader stages when transitioning into a shader-readable/general layout.STOREvs.GENERALsampling (vulkan_replay.h:434-439,5603-5610;d3d12_vulkan_device.cpp:22013-22016):A mixed read-only D24S8 draw sets
STORE_OP_NONEon the read-only aspect andSTORE_OP_STOREon the writable sibling while placing the read-only aspect inGENERAL. Per the Vulkan render pass store-operation rules, on implementations whereVkPhysicalDeviceMaintenance7PropertiesKHR::separateDepthStencilAttachmentAccess == VK_FALSE, storing the writable sibling aspect can still read/write back the read-only aspect, racing a shader sampling it. Device selection currently checksseparateDepthStencilLayoutsonly, andd3d12_dsv_readonly_testuses an empty pixel shader without SRV sampling so it does not exercise this case. Please gate or guard simultaneous sampling of a packed depth/stencil aspect whenseparateDepthStencilAttachmentAccessis unavailable.d3d12_com.cpp:2042-2047;d3d12_vulkan_device.cpp:12922-12939):Under
LEONIDA_ASYNC_PIPELINES=1,request_draw_pipeline()/request_early()only passesdepth_.resource != 0and omitsdepth_.dsv_flags. Recording pre-compiles the writable variant, while replay requests the read-only variant key (vulkan_replay.h:2872-2889), which can cause the first read-only draw to be skipped while that variant compiles. Passingdepth_.dsv_flagsintorequest_pipeline_build/request_earlykeeps recording and replay in sync.rect_view(vulkan_replay.h:3675-3678):When read-only flags mask out all requested clear aspects, line 3675 sets
p.skip = true, but line 3676 still unconditionally callsrect_view(...). With non-emptyrects, that still requiresrenderinghooks and allocates an image view (and can returnunsupportedif!rendering) for a no-op clear. Guardingrect_viewwithif (!p.skip)afterview_range()avoids this.d3d12_dsv_readonly_test.cpp:181-187,451):The test writes shaders to a fixed temp directory name and removes it on exit, which can collide if two instances run concurrently (including PID or a unique suffix avoids that).
AI-assisted review + local MSVC/dual-GPU verification.
Imported from ubiquitarianism/leonida. Originally posted by akimfomin on 2026-11-28T02:00:21Z.
KLBF #27 supplies a separate depth-bounds control. For the read-only DSV fix, run otherwise identical draws with write enabled, read-only depth and no stencil attachment. Match query and color results while asserting the depth value can change only in the writable arm. That independently checks bound state and masking.
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-28T09:50:41Z.
@timbot103 @akimfomin Addressed all review findings and added the paired writable-vs-readonly D32 control in
2f5e8a808:equest_pipeline_build -> PipelineState::request_early so recording pre-warms the same
ead_only_depth /
ead_only_stencil variant bits as replay.
ect_view(...) with if (!p.skip) after iew_range() so no-op rectangular clears do not require rendering hooks or allocate an image view.
Verification
GPUs tested: NVIDIA GeForce RTX 5070 12 GB (Windows 11, driver 610.88, Vulkan 1.4.341, VK_LAYER_KHRONOS_validation 1.4.363).
AI-assisted (Antigravity, Gemini).
Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-28T14:36:21Z.
Review: COMMENTED
Static code audit against
92e574a1a+ec740bcc3. I found two issues.runtime/src/vulkan_replay.h:5604). When packed depth/stencil attachment access is coupled and the writable sibling stores, the fallback takes the read-only aspect out ofGENERAL. The bindless SRV still declaresGENERAL(runtime/shims/d3d12_vulkan_device.cpp:8052). A draw that samples that aspect violatesVUID-vkCmdDraw-imageLayout-00344, and the tracked layout also persists for later reads in the same D3D12 state. Please use an isolated sampled copy with a matching descriptor or explicitly refuse the unsupported simultaneous use. Preserve the SRV layout for subsequent reads. The current GPU test declares an SRV state but never samples the image. Vulkan draw validityruntime/test/d3d12_dsv_readonly_test.cpp:504). Require equal expected sample counts when occlusion queries are precise. With imprecise queries, each passing draw only guarantees a nonzero result. Vulkan occlusion queriesAI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-28T15:45:30Z.
@timbot103
bd9479348fixes the query assertion. Both arms must equal the expected sample count with precise queries. Without them both must be nonzero.d3d12_dsv_readonlyanddsv_readonly_replaypassed on RTX 5070.The packed depth/stencil sampled-layout issue is still open. A resource marked
sampled_in_generalmay have an SRV even when the draw does not sample it, so rejecting every mixed DSV with that flag would reject ordinary stencil draws as well. The remaining fix needs to preserve the sampled layout and identify or isolate the simultaneous read before recording the draw.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by Maticcm on 2026-11-28T20:42:48Z.
Verified
bd9479348822513ff5ffab1a0c0503adb92d35b0independently on native Windows, using an RTX 3080 desktop (10 GiB, driver 630.20), Windows 11 build 26340, MSVC 19.50.35717, RelWithDebInfo and Vulkan SDK 1.4.363.1 with Khronos validation enabled.d3d12_dsv_readonlypassed with zero validation errors. This covered the D32_FLOAT writable/read-only pair and the occlusion count assertion.vulkaninforeportedocclusionQueryPrecise = truefor the RTX 3080, and the fixture enables that feature when advertised.dsv_readonly_replay,d3d12_depth24_draw, andd3d12_typeless_depthalso passed. The two shared depth controls passed at common ancestor5f3790c8e875288da8cf05081d661471088e1e0a. Overall 4/4 at the PR head and 2/2 at the ancestor, with no CTest skips.Synthetic fixtures. AI-assisted (Codex).
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-28T21:13:52Z.
@timbot103
9f534d3cafixes the later-read half of the packed depth/stencil layout issue. If the sampled aspect entered a mixed draw in GENERAL and the attachment uses the optimal fallback, replay restores its GENERAL layout after ending rendering. On coupled-layout devices this restores both planes together. The mock regression fails on the previous head and now passes in both split and coupled modes.All four focused CTests passed on RTX 5070 (610.88), Windows 10 22H2, MSVC 19.44, with Khronos validation available. The simultaneous sampled draw on hardware without separateDepthStencilAttachmentAccess remains open; this change covers reads after that attachment scope.
AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T21:46:06Z.
Verified updated head
9f534d3camerged with mainaa918e5d9on physical gfx906 (RADV Mesa 26.0.8, Linux Wine 11.0). With D32 cleared to 0.75 and a draw at 0.25, main stored 0.25 through both the read-only and writable views. The merge kept 0.75 read-only / 0.25 writable. Precise occlusion counted 1,024 samples in both arms on both builds: the read-only draw ran rather than disappearing.The packed depth/stencil cases used the D32S8 fallback on this device. With depth read-only, the merge preserved 0.75 while stencil incremented twice to 18; main overwrote depth with 0.25 and stencil reached only 17. A partial clear on the merge left depth unchanged and updated stencil. Main reported one synchronization write-after-write hazard; the merged fixture passed without validation errors, hazards or device loss.
The new post-render
GENERALrestoration was checked separately at the replay boundary: 4/16 on the preceding PR head versus 16/16 on this revision across split/coupled aspect layouts, mixed entry layouts and untouched mip/layer neighbors. Only ranges that entered inGENERALwere restored. This was a host-side command/tracker check, not a physical later-sample result. Simultaneous sampling while a writable sibling stores was not tested.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T11:54:14Z.
Checked
9f534d3caagainstmain8fb974878on Windows 11 10.0.26300: it does not merge (git merge-tree --write-tree), so I ran no tests.runtime/CMakeLists.txt, add/add.06c3b4a6a(2026-11-25, RT-D24-CPU-ROUNDEVEN) added thedepth24_cpu_testblock where this PR adds its test targets.mainhas no handling ofD3D12_DSV_FLAG_READ_ONLY_DEPTH/READ_ONLY_STENCILinruntime/shimsorruntime/src. The rebase looks mechanical: keep both CMake blocks.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T15:06:36Z.
Physical follow-up for the post-render
GENERALrestoration at PR headc6fabd339, merged cleanly ontoc22a0a732(tree598d31332). I drove the production replay emitter on native Vulkan with a synthetic 8×8D32_SFLOAT_S8_UINTimage and forced the replay fallback forseparate_depth_stencil_attachment_access. Both devices advertise the capability. I ran the split and coupled layout paths independently.The test clears depth to 0.75 and stencil to 0x20. It then draws at 0.25 with the mixed read-only attachment. A subsequent compute dispatch in the same command buffer fetches the previously read-only aspect through a
GENERALdescriptor, with no image barrier inserted by the test between replay and dispatch. The writable sibling is read back separately.8/8 draws and 8/8 sample-only controls passed, including attachment layout/store-op checks. The stock CPU fixture passed 12 checks. Khronos validation and synchronization validation reported zero errors. In a separate negative-control build I removed only the post-render restoration loop. All eight recordings then reported
VUID-vkCmdDispatch-imageLayout-00344, and I discarded those command buffers before submission.AMD Raphael iGPU (RADV Mesa 26.3.1-arch3.5) and RTX 4070 SUPER (NVIDIA 620.73.04), CachyOS, native Vulkan. This covers sampling after the attachment scope. Offline, synthetic inputs, AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-29T15:54:57Z.
Merged
main(bfb54b8759) as1e2954d151to resolve theruntime/src/vulkan_replay.hconflict with #778 (d3d-sample-positions):GraphicsPipeline::read_only_depth/read_only_stencilto bits11/12socustom_sampleskeeps bit10.active_samplesthroughto_attachment,initialize, and the post-rendersampled_depth_stencil_restorebarrier.Local verification (Windows 11, MSVC 19.44, RTX 5070,
LEONIDA_VK_VALIDATION=1,VK_VALIDATE_SYNC=1):ctest --output-on-failure -R "^(dsv_readonly_replay|d3d12_dsv_readonly|depth24_cpu|d3d12_depth24_draw)$": 4/4 passed.python -I scripts/check_no_game_data.py: passed.git merge-tree --write-tree main HEAD: clean against1d3da5ebc7.AI-assisted (Antigravity, Gemini).
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T12:31:21Z.
Independent Wine A/B on the current DSV revision. I built GitHub merge
717bd241(a7f11116aover497bdd039) in Win64 Release using clang-cl 23.1.5 and Windows SDK 10.0.26100. CachyOS, Wine 11.22, RTX 4070 SUPER (620.73.04) and Radeon 610M (RADV 26.3.1). Synthetic shaders and attachments.d3d12_dsv_readonly,d3d12_depth24_drawanddsv_readonly_replaypassed on both GPUs. Replay reported 12 checks. The D32 read-only draw retained 0.75, the writable control stored 0.25, and its paired occlusion checks passed.main. Both GPUs reported the same six failures. They cover unknown flags, the three D24 depth/stencil read-only combinations, the partial clear, and D32 read-only depth changing to 0.25.vkCreateDevicediagnostic on both arms and both GPUs.VK_EXT_external_memory_dma_bufwas enabled withoutVK_KHR_external_memory_fd(01387). The test logs show no additional validation error class.AI-assisted with OpenAI Codex. The observations were independently checked against the raw logs.
Imported from ubiquitarianism/leonida. Originally posted by ammonium231 on 2026-11-30T13:43:42Z.
RTX 3090 / 621.40, validation on,
a7f11116amerged onto mainf9f3ec4c6: d3d12_dsv_readonly_test OK (all read-only flag cases), dsv_readonly_replay_test 12 pass, d3d12_depth24_draw_test 0 failures (main 0). No validation errors.Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-30T19:49:16Z.
Fixed the
replay_state_cacheCI failure ina04eff9a4b:replay_state_cache_test.cpp's read-only DSV CPU mock to provide a pipelinevariantcallback andseparate_depth_stencil_attachment_access = true(matching theGENERALlayout path it asserts).replay_state_cache_test.cppto mark the read-only pipelines'depth_writes/stencil_writesaccurately and pass the device'sVK_KHR_maintenance7separateDepthStencilAttachmentAccessproperty intoVulkanContext(falling back toD32_SFLOATwhen the device lacks separate attachment access).Verified locally on Windows 11, MSVC 19.44, NVIDIA GeForce RTX 5070 12 GB (driver 610.88, Vulkan 1.4.341,
LEONIDA_VK_VALIDATION=1):d3d12_dsv_readonly,dsv_readonly_replay,d3d12_state_map,replay_state_cache: 4/4 passed.VK_VALIDATE_SYNC=1):d3d12_dsv_readonlyandreplay_state_cache2/2 passed.python -I scripts/check_no_game_data.py: passed;git merge-tree --write-tree origin/main HEAD: clean.AI-assisted (Antigravity, Gemini).
Imported from ubiquitarianism/leonida. Originally posted by ammonium231 on 2026-11-30T22:22:52Z.
Re-run at
a04eff9a4on maina596adfac: d3d12_dsv_readonly OK, 0 validation errors (PR-only); dsv_readonly_replay 12 checks passed (PR-only); d3d12_depth24_draw 0 failure(s) (main 0 failure(s)); replay_state_cache ALL PASS (main ALL PASS); d3d12_state_map OK (main OK). No validation errors.Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-02T00:44:26Z.
Thank you for the careful work and thorough verification here. The legacy C++/Vulkan runtime/ directory is now frozen and deprecated as active development focuses on the d3d12/ and clean-room Rust vulkan/ tracks, so we are closing open legacy runtime/ PRs. We really appreciate the effort that went into this.
Pull request closed