⚠️ DRAFT — not ready for pickup. Title still being refined; do not assign or start work yet.
Background
#1046 added depth (SV_Depth, Depth32 SRV) but no stencil. The body of #1046 mentions stencil and SV_StencilRef, however delivering it cleanly is well beyond the bare AC bullets:
Format::D32FloatS8Uint already exists in the enum and is mapped to DXGI_FORMAT_D32_FLOAT_S8X24_UINT / VK_FORMAT_D32_SFLOAT_S8_UINT / MTL::PixelFormatDepth32Float_Stencil8, but PipelineDesc.DSFormat = Format::D32FloatS8Uint; is hardcoded in lib/API/{DX,VK,MTL}/Device.cpp — there's no YAML hook to choose stencil vs. depth-only, and D24_UNORM_S8_UINT is missing entirely.
- No
StencilState struct exists in shared include/Support/Pipeline.h — stencil func / mask / read-mask / write-mask / front/back op are not plumbed through YAML or PSO desc.
- No call site for
OMSetStencilRef (DX) / setStencilReferenceValue (MTL) / vkCmdSetStencilReference (VK).
- Only a depth readback path exists today — stencil readback is missing.
SV_StencilRef requires the PSSpecifiedStencilRefSupported capability (FL 11_1) — needs a lit feature like SV_StencilRef-tier and a runtime capability check.
Originally added as an AC on #1046 (2026-06-01) and reverted later the same day after scope analysis: the work spans 5+ shared-header + 3-backend touch-points + a new capability gate + a new test (>3 days), large enough to warrant its own tracker so #1046 can close cleanly on the SV_Depth deliverable.
Acceptance criteria
Notes
Refs #1046, llvm/wg-hlsl#400.
Background
#1046 added depth (
SV_Depth,Depth32SRV) but no stencil. The body of #1046 mentions stencil andSV_StencilRef, however delivering it cleanly is well beyond the bare AC bullets:Format::D32FloatS8Uintalready exists in the enum and is mapped toDXGI_FORMAT_D32_FLOAT_S8X24_UINT/VK_FORMAT_D32_SFLOAT_S8_UINT/MTL::PixelFormatDepth32Float_Stencil8, butPipelineDesc.DSFormat = Format::D32FloatS8Uint;is hardcoded inlib/API/{DX,VK,MTL}/Device.cpp— there's no YAML hook to choose stencil vs. depth-only, andD24_UNORM_S8_UINTis missing entirely.StencilStatestruct exists in sharedinclude/Support/Pipeline.h— stencil func / mask / read-mask / write-mask / front/back op are not plumbed through YAML or PSO desc.OMSetStencilRef(DX) /setStencilReferenceValue(MTL) /vkCmdSetStencilReference(VK).SV_StencilRefrequires thePSSpecifiedStencilRefSupportedcapability (FL 11_1) — needs a lit feature likeSV_StencilRef-tierand a runtime capability check.Originally added as an AC on #1046 (2026-06-01) and reverted later the same day after scope analysis: the work spans 5+ shared-header + 3-backend touch-points + a new capability gate + a new test (>3 days), large enough to warrant its own tracker so #1046 can close cleanly on the
SV_Depthdeliverable.Acceptance criteria
Format::D24UnormS8Uinttoinclude/API/Resources.h(enum + all 5 helper switches:getElementSize,getDataFormat,getNumChannels,isDepthFormat,isStencilFormat).D24UnormS8Uint→DXGI_FORMAT_D24_UNORM_S8_UINT(and SRVDXGI_FORMAT_R24_UNORM_X8_TYPELESSfor depth read,DXGI_FORMAT_X24_TYPELESS_G8_UINTfor stencil read) inlib/API/DX/DXResources.h.D24UnormS8Uint→VK_FORMAT_D24_UNORM_S8_UINTinlib/API/VK/VKResources.h; MTL falls back toDepth32Float_Stencil8with a TODO.DSFormatconfigurable via YAML (extendPipeline.h::PipelineDesc+ the YAML parser).StencilStatestruct to sharedPipeline.h(func + mask + read/write mask + front/back op + ref).D3D12_DEPTH_STENCIL_DESC/ VKVkPipelineDepthStencilStateCreateInfo/ MTLMTLDepthStencilDescriptor.OMSetStencilRef/vkCmdSetStencilReference/setStencilReferenceValuecall site (using the runtime ref from YAML).SV_StencilReflit feature (D3D12_FEATURE_DATA_D3D12_OPTIONS::PSSpecifiedStencilRefSupported).SV_StencilRef, framework reads the stencil aspect and verifies.Notes
Refs #1046, llvm/wg-hlsl#400.