You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
d3d12: ignore OMSetFrontAndBackStencilRef on closed command lists - #8809
Match Windows 11 D3D12 (live WARP and native NVIDIA GeForce RTX 5090) for ID3D12GraphicsCommandList8::OMSetFrontAndBackStencilRef when called on an already-closed command list:
In
untime/shims/d3d12_com.cpp, change if (list_.closed()) return check(false); to if (list_.closed()) return; (matching OMSetStencilRef and OMSetBlendFactor), so a post-close call is a no-op and does not poison invalid_ for ExecuteCommandLists.
Add synthetic host-parity and regression tests in
untime/test/d3d12_close_parity_test.cpp,
untime/test/d3d12_com_test.cpp, and
untime/test/d3d12_gcl8_test.cpp.
Live Windows 11 D3D12 Probe (WARP + NVIDIA GeForce RTX 5090)
Open DIRECT list: OMSetFrontAndBackStencilRef(1, 2) -> Close() returns S_OK, ExecuteCommandLists + fence wait succeeds (GetDeviceRemovedReason() == S_OK).
BUNDLE list: open + post-close OMSetFrontAndBackStencilRef -> Close() (S_OK), second Close() (E_FAIL), ExecuteBundle on DIRECT list + Close() (S_OK) + ExecuteCommandLists succeeds (GetDeviceRemovedReason() == S_OK).
Verification
Built in
untime/build (MSVC �cvars64.bat + Ninja RelWithDebInfo, LEONIDA_BUILD_WINDOWS_RUNTIME=ON) and tested on NVIDIA GeForce RTX 5090 with LEONIDA_VK_VALIDATION=1 (0 VUIDs):
d3d12_gcl8: Passed
d3d12_trace: Passed (19 ordered entries)
d3d12_close_parity: Passed (114 cases, 79 match live WARP, 0 failures; post-close OMSetFrontAndBackStencilRef + ExecuteCommandLists + Reset verified on both Leonida Vulkan and live WARP)
Tested ede13073c on Windows 11 (10.0.26300), NVIDIA GeForce RTX 5070 (driver 32.0.16.2101, subgroup 32), MSVC with SDK 10.0.26100, Release, merged onto main867d922f0 together with #8815, #8814, #8809, #8784, #8783 and #8813 (no conflicts): pass.
d3d12_close_parity, d3d12_com and d3d12_gcl8 pass.
Tested ede13073c on Windows 11 build 26300, RTX 5060 driver 610.88, and MSVC 19.44. All four checks passed: d3d12_close_parity, d3d12_com, d3d12_gcl8, and d3d12_trace. I added a local regression check that calls OMSetFrontAndBackStencilRef after closing a bundle and verifies that the parent still receives the bundle’s original stencil values. With the fix reverted, that check failed and the direct-list test rejected submission. Both passed with the fix. Synthetic inputs only. Tested without Vulkan validation layers. AI-assisted (Codex).
Tested ede13073c (based on main867d922f0) on Windows 11, NVIDIA GeForce RTX 5060 Ti (Blackwell), driver 617.42, VS 2026 (scripts/build_runtime.ps1, RelWithDebInfo), Vulkan SDK 1.4.363.0: pass. Synthetic, no game files.
d3d12_com, d3d12_gcl8, d3d12_close_parity: pass, also with LEONIDA_VK_VALIDATION=1.
The new checks catch the bug: with runtime/shims/d3d12_com.cpp reverted to main (tests kept), d3d12_com fails at line 366 (last_execute_result(queue.p) == ReplayResult::success, "ExecuteCommandLists failed: a list is not closed") and d3d12_close_parity at lines 485 and 535 (check_post_close_front_back_stencil_ref). d3d12_gcl8 passes either way.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Match Windows 11 D3D12 (live WARP and native NVIDIA GeForce RTX 5090) for ID3D12GraphicsCommandList8::OMSetFrontAndBackStencilRef when called on an already-closed command list:
untime/shims/d3d12_com.cpp, change if (list_.closed()) return check(false); to if (list_.closed()) return; (matching OMSetStencilRef and OMSetBlendFactor), so a post-close call is a no-op and does not poison invalid_ for ExecuteCommandLists.
untime/test/d3d12_close_parity_test.cpp,
untime/test/d3d12_com_test.cpp, and
untime/test/d3d12_gcl8_test.cpp.
Live Windows 11 D3D12 Probe (WARP + NVIDIA GeForce RTX 5090)
Verification
Built in
untime/build (MSVC �cvars64.bat + Ninja RelWithDebInfo, LEONIDA_BUILD_WINDOWS_RUNTIME=ON) and tested on NVIDIA GeForce RTX 5090 with LEONIDA_VK_VALIDATION=1 (0 VUIDs):
Claim: #8683 (comment)
AI-assisted (Gemini 4 Neon).