Skip to main content
Describes depth-stencil state.

Syntax

Members

DepthEnable
Type: BOOL
Specifies whether to enable depth testing. Set this member to TRUE to enable depth testing. DepthWriteMask
Type: D3D12_DEPTH_WRITE_MASK
A D3D12_DEPTH_WRITE_MASK-typed value that identifies a portion of the depth-stencil buffer that can be modified by depth data. DepthFunc
Type: D3D12_COMPARISON_FUNC
A D3D12_COMPARISON_FUNC-typed value that identifies a function that compares depth data against existing depth data. StencilEnable
Type: BOOL
Specifies whether to enable stencil testing. Set this member to TRUE to enable stencil testing. StencilReadMask
Type: UINT8
Identify a portion of the depth-stencil buffer for reading stencil data. StencilWriteMask
Type: UINT8
Identify a portion of the depth-stencil buffer for writing stencil data. FrontFace
Type: D3D12_DEPTH_STENCILOP_DESC
A D3D12_DEPTH_STENCILOP_DESC structure that describes how to use the results of the depth test and the stencil test for pixels whose surface normal is facing towards the camera. BackFace
Type: D3D12_DEPTH_STENCILOP_DESC
A D3D12_DEPTH_STENCILOP_DESC structure that describes how to use the results of the depth test and the stencil test for pixels whose surface normal is facing away from the camera.

Remarks

A D3D12_GRAPHICS_PIPELINE_STATE_DESC object contains a depth-stencil-state structure that controls how depth-stencil testing is performed by the output-merger stage. This table shows the default values of depth-stencil states.
StateDefault Value
DepthEnableTRUE
DepthWriteMaskD3D12_DEPTH_WRITE_MASK_ALL
DepthFuncD3D12_COMPARISON_FUNC_LESS
StencilEnableFALSE
StencilReadMaskD3D12_DEFAULT_STENCIL_READ_MASK
StencilWriteMaskD3D12_DEFAULT_STENCIL_WRITE_MASK
FrontFace.StencilFailOpandBackFace.StencilFailOpD3D12_STENCIL_OP_KEEP
FrontFace.StencilDepthFailOpandBackFace.StencilDepthFailOpD3D12_STENCIL_OP_KEEP
FrontFace.StencilPassOpandBackFace.StencilPassOpD3D12_STENCIL_OP_KEEP
FrontFace.StencilFuncandBackFace.StencilFuncD3D12_COMPARISON_FUNC_ALWAYS
The formats that support stenciling are DXGI_FORMAT_D24_UNORM_S8_UINT and DXGI_FORMAT_D32_FLOAT_S8X24_UINT.

Requirements

Header: d3d12_xs.h or d3d12_x.h
Library: d3d12_xs.lib or d3d12_x.lib
Supported Platforms: XBOX Series consoles and XBOX One family

See Also

CD3DX12_DEPTH_STENCIL_DESC Core Structures
Last modified on August 20, 2026