mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:45:53 +01:00
[PR #878] [MERGED] d3d12: separate front and back stencil masks (D3D-STENCIL-FACE-MASKS) #916
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#916
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/878
Author: @kawaii-shakal
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @aslan2142
Base:
main← Head:d3d-stencil-face-masks📝 Commits (1)
a7d86d8d3d12: separate front and back stencil masks (D3D-STENCIL-FACE-MASKS)📊 Changes
4 files changed (+142 additions, -20 deletions)
View changed files
📝
docs/d3d12_vulkan.md(+10 -6)📝
runtime/shims/d3d12_vulkan_device.cpp(+23 -10)📝
runtime/test/d3d12_state_sweep_test.cpp(+105 -2)📝
runtime/test/d3d12_vulkan_device_test.cpp(+4 -2)📄 Description
Claimed in the coordination issue as: D3D-STENCIL-FACE-MASKS (claim)
What and why
On
main, aD3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL2subobject whoseFrontFaceandBackFacemasks differ is refused withE_NOTIMPL("separate front and back stencil masks are not supported yet").D3D12_FEATURE_D3D12_OPTIONS14also reportsIndependentFrontAndBackStencilRefMaskSupported = FALSE, althoughID3D12GraphicsCommandList8::OMSetFrontAndBackStencilRef's per-face references already reach the draw (vkCmdSetStencilReferencewith a face mask). Vulkan has a compare mask and a write mask per face inVkStencilOpState, so no device feature is needed.runtime/shims/d3d12_vulkan_device.cpp:parse_pipeline_streamkeeps the front face's masks in theD3D12_GRAPHICS_PIPELINE_STATE_DESC. The back face's go beside it inPipelineStream::back_stencil.create_graphicstakes them as an optional argument, used only fordepth.back.OPTIONS14.IndependentFrontAndBackStencilRefMaskSupportedis TRUE.The classic
CreateGraphicsPipelineStatepath and its cached-PSO key are unchanged, sinceD3D12_DEPTH_STENCIL_DESChas one mask pair. The stream path takes no cached-PSO key.Tests
d3d12_state_sweep_testcompares against the host D3D12 device on the same adapter. It builds 16 more PSOs from a stream withDEPTH_STENCIL2, covering:OMSetFrontAndBackStencilRef;Each draw passes
EQUALwithREPLACEand fails withINVERT, over stored0xa5. The colour and stencil readbacks must be byte-identical with the host's.d3d12_vulkan_device_testnow expects the cap to be TRUE. Its host comparison checks that the cap does not exceed the host's.Tested
Windows 11 Pro 26300, MSVC 19.50.35721.0, Vulkan SDK 1.4.363.0, rebased on
main8f05e09e2.d3d12_state_sweep: 498 cases compared with the host on the RTX 5070 Ti, 0 differ, 0 skipped. Same result withLEONIDA_VK_VALIDATION=1(synchronization validation).ctest -R "d3d12_state_sweep|d3d12_vulkan_device$|gcl8|d3d12_com$|d3d12_depth24|d3d12_m3_frame|d3d12_draw": 6/6 passed, without and with validation.ctest -C RelWithDebInfo(before the rebase, on5606eab23): 293 run, 292 passed. The only failure isd3d12_execute_indirect_validation, which fails onmaintoo (#337 / #306).d3d12_meshwithLEONIDA_VK_VALIDATION=1on the rebased branch: passes with 0 validation errors (theVUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076errors seen on the older base were fixed onmainby #540).python -I scripts/check_no_game_data.pyon the changed files: clean.tests/test_docs_*.py: all pass excepttest_docs_links, which flagsdocs/boot_leads.md→CONTRIBUTING.md. That file is not touched here; the failure comes frommain.GPUs tested: NVIDIA GeForce RTX 5070 Ti (Blackwell, PCI 10de:2c05), driver 617.42, Vulkan 1.4.351, Windows 11 Pro 26300
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.