Repository navigation
Runtime: guard closed-list IA/OM/PSO state setters and expand D3D12 Close parity tests - #6644
Conversation
…lose parity tests
0xTehuti
left a comment
There was a problem hiding this comment.
Hardware & Environment
- Host: Windows 11 Pro x64 (Build 26100)
- GPU: NVIDIA GeForce RTX 2070 SUPER (8192 MB VRAM, Driver 595.79, Vulkan 1.4)
- Toolchain: MSVC 2022 Community (vcvars64, cl.exe 19.44.35225.0), Ninja 1.13, CMake 4.4, Windows SDK 10.0.26100.0
- Validation:
LEONIDA_VK_VALIDATION=1(VK_LAYER_KHRONOS_validationactive)
Verification Summary
All 7 test targets configured, built cleanly with MSVC 2022 and Ninja, and executed natively on the RTX 2070 SUPER under full Vulkan validation (LEONIDA_VK_VALIDATION=1):
-
d3d12_close_parity_test.exe:113 cases, 78 match WARP, 20 known layer-stricter, 15 known layer-looser, 0 not run, 0 where WARP differs from the measured column, 0 failures- All 13 newly added live-WARP parity cases passed matching expected behaviors:
IASetIndexBufferwithnullptr,R16_UINT,R32_UINT,UNKNOWN(size 0 & 64), andR32_FLOAT.IASetPrimitiveTopologywithTRIANGLELIST, gap value7,32_CONTROL_POINT_PATCHLIST, and65.OMSetBlendFactorandOMSetStencilRef(7).ExecuteBundle after post-close state calls on bundle(closed bundle remains executable withS_OK).
-
d3d12_com_test.exe:- Closed-list immutability assertions passed on direct command list and bundles.
- Calling state setters post-
Close()does not mutate recorded state or invalidate an already-closed bundle. COM list/queue/fence: 16 colour, depth and stencil texels matched; queue wait held the GPU.
-
CTest Suite (
ctest -R "^d3d12_(close_parity|com|draw|bundle|bundle_forbidden|gcl8|vulkan_device)$"under Vulkan validation):d3d12_com: Passed (0 VUID errors)d3d12_gcl8: Passed (0 VUID errors)d3d12_vulkan_device: Passed (0 VUID errors)d3d12_close_parity: Passed (0 VUID errors)d3d12_draw: Passed (0 VUID errors)d3d12_bundle: Passed (14 scenarios on the layer, 25 host comparisons, 0 failures, 0 VUID errors)d3d12_bundle_forbidden: Passed (10 on the layer, 10 compared with host, 0 failures, 0 VUID errors)
-
Repo Hygiene & Standards:
git diff --check: clean (no whitespace or formatting defects).python -m unittest discover -s tests -p "test_ctest_registration.py": 4 tests passed.- Clean-room compliant: zero game data, archives, or proprietary files used or referenced.
Code Review & Audit
runtime/shims/d3d12_com.cpp:- The
if (list_.closed()) return;early exits inExecuteBundle,SetPipelineState,ClearState,IASetPrimitiveTopology,IASetIndexBuffer,OMSetBlendFactor, andOMSetStencilRefcorrectly prevent mutation of internal state (front_stencil_ref_,back_stencil_ref_,blend_factor_,topology_,index_, etc.) afterClose(). - Fixes bundle state deferred registration (
calls_) and preventsSetPipelineStatefrom leaking holds on closed bundles. - Correctly preserves closed bundle validity for subsequent
ExecuteBundlecalls, matching empirical D3D12 WARP / native driver behavior.
- The
runtime/test/d3d12_close_parity_test.cpp&runtime/test/d3d12_com_test.cpp:- Comprehensive, reproducible regression tests verifying both native direct list and bundle behavior against WARP.
LGTM! Verified and ready to merge.
AI-assisted review (Gemini 3.8 Flash High) executed on native hardware.
devnull34
left a comment
There was a problem hiding this comment.
Hardware & Environment
- Host: Windows 11 Build 26300 x64
- GPU: AMD Radeon RX 7900 GRE (16 GB VRAM, RDNA3 gfx1100, Vulkan 1.3.296)
- Toolchain: MSVC 19.44 (Visual Studio 2022), CMake 4.4, Windows SDK 10.0.26100.0
Verification Summary
Targets compiled with MSVC 19.44 and executed natively on AMD Radeon RX 7900 GRE:
-
**\d3d12_close_parity_test.exe**:
- \close parity: 113 cases, 78 match WARP, 20 known layer-stricter, 15 known layer-looser, 0 not run, 0 where WARP differs from the measured column, 0 failures\
- Verified newly added closed-list parity tests for \IASetIndexBuffer\ (null, R16_UINT, R32_UINT, UNKNOWN, R32_FLOAT), \IASetPrimitiveTopology\ (TRIANGLELIST, gap 7, 32_CONTROL_POINT_PATCHLIST, 65), \OMSetBlendFactor, \OMSetStencilRef, and \ExecuteBundle after post-close state calls on bundle.
-
**\d3d12_com_test.exe**:
- Passed with 16 color, depth and stencil texels matched; queue wait held the GPU.
- Verified that calling state setters on closed direct command lists and bundles (\OMSetStencilRef, \OMSetBlendFactor, \IASetPrimitiveTopology, \IASetIndexBuffer, \SetPipelineState, \ClearState) are ignored and do not mutate internal state or invalidate bundles.
-
CTest:
- \d3d12_com: Passed (0.20s)
- \d3d12_close_parity: Passed (0.17s)
Clean-room compliant; zero game data or proprietary files used or referenced. LGTM!
|
Tested
AI-assisted (Claude Code). No game files. |
|
Tested
AI-assisted (Claude Code), no game files. |
|
Independent dual-adapter check of Each run checked 113 cases against live WARP. All 13 new cases returned S_OK on both sides. Totals were 78 matches, 20 known layer-stricter cases and 15 known layer-looser cases, with zero skips or deviations from the recorded WARP expectations. COM readback, the draw and the bundle comparisons also passed on both adapters. For coordination with #6610, a known layer-stricter |
shayderrr
left a comment
There was a problem hiding this comment.
Summary
runtime/shims/d3d12_com.cpp adds if (list_.closed()) return; to ExecuteBundle, SetPipelineState, ClearState, IASetPrimitiveTopology, IASetIndexBuffer, OMSetBlendFactor and OMSetStencilRef, matching D3D12's no-op semantics after Close. d3d12_close_parity_test.cpp adds a closed bundle and many setter cases; d3d12_com_test.cpp checks closed-list calls neither mutate recorded state nor invalidate a bundle.
Why merge
Brings the shim into line with the real API, preventing spurious state changes and parity failures on post-close calls.
Verdict: Approve
Summary
Why mergeBrings the shim into line with the real API, preventing spurious state changes and parity failures on post-close calls. Verdict: Approve |
Claim: #6414 (comment)
Summary
100% generic D3D12->Vulkan command-list state-setter closed-list guards and live-WARP
Close()parity coverage (deliberately excludingIASetVertexBuffers, queue-type checks,RSSetViewports/RSSetScissorRects, andOMSetRenderTargets/SetDescriptorHeaps).Changes
runtime/shims/d3d12_com.cpp: Addedif (list_.closed()) return;guards toExecuteBundle,SetPipelineState,ClearState,IASetPrimitiveTopology,IASetIndexBuffer,OMSetBlendFactor, andOMSetStencilRef:Close()calls on a direct list from silently mutating recorded state (front_stencil_ref_,back_stencil_ref_,blend_factor_,topology_,index_,compute_pipeline_,graphics_pipeline_,held_).SetPipelineStateon a closed bundle previously still callinghold(state)afterdefer()returnedtrue.Close(), matching empirical Windows 11 WARP and RTX 5090 D3D12 behavior whereExecuteBundleon such a bundle still closes withS_OK.IASetIndexBufferacceptsnullptr,R16_UINT,R32_UINT,UNKNOWN(size 0 and 64),R8_UINT,R32_FLOAT, and format999atClose()(S_OK) on both direct lists and bundles; invalid formats are already rejected at indexed-draw replay invulkan_replay.h.IASetPrimitiveTopologyacceptsUNDEFINED,TRIANGLELIST, gap values (7,8,9),32_CONTROL_POINT_PATCHLIST(64),65, and99atClose()(S_OK) on both direct lists and bundles.SetPipelineState(nullptr)crashes (access violation) on Windows D3D12 without debug layer and is explicitly expected to close withS_OKbyd3d12_gcl8_test, so it is kept compatible and omitted from live-WARP cases.runtime/test/d3d12_close_parity_test.cpp: Added 13 live-WARPClose()parity cases coveringIASetIndexBuffer(nullptr,R16_UINT,R32_UINT,UNKNOWNsize 0/64,R32_FLOAT),IASetPrimitiveTopology(TRIANGLELIST, gap7,32_CONTROL_POINT_PATCHLIST,65),OMSetBlendFactor,OMSetStencilRef(7), andExecuteBundleafter post-close state calls on a closed bundle.runtime/test/d3d12_com_test.cpp: Added closed-list immutability assertions for direct lists and bundles verifying post-close state setters do not mutate recorded state or invalidate an already-closed bundle.Verification (Windows 11, NVIDIA GeForce RTX 5090,
LEONIDA_VK_VALIDATION=1)All 7 targets built in
RelWithDebInfo(Ninja) and passed with 0 failures and 0 Vulkan validation errors:d3d12_close_parity_test:113 cases, 78 match WARP, 20 known layer-stricter, 15 known layer-looser, 0 not run, 0 where WARP differs from the measured column, 0 failuresd3d12_draw_test: passed (0validation errors)d3d12_bundle_test:14 scenarios on the layer, 25 host comparisons, 0 failuresd3d12_bundle_forbidden_test:10 on the layer, 10 compared with the host, 0 hosts disagree, 0 failuresd3d12_com_test: passed (16 colour, depth and stencil texels matched; queue wait held the GPU)d3d12_gcl8_test: passed (QueryInterface, OMSetFrontAndBackStencilRef(1, 2), refcount balanced)d3d12_vulkan_device_test: passed (all checks matched against host RTX 5090)git diff --check: cleanAI-assisted (Gemini 4 Neon).