D3D12_DEPTH_STENCIL_DESC structure (d3d12.h)

Describes depth-stencil state.

Syntax

typedef struct D3D12_DEPTH_STENCIL_DESC {
  BOOL                       DepthEnable;
  D3D12_DEPTH_WRITE_MASK     DepthWriteMask;
  D3D12_COMPARISON_FUNC      DepthFunc;
  BOOL                       StencilEnable;
  UINT8                      StencilReadMask;
  UINT8                      StencilWriteMask;
  D3D12_DEPTH_STENCILOP_DESC FrontFace;
  D3D12_DEPTH_STENCILOP_DESC BackFace;
} D3D12_DEPTH_STENCIL_DESC;

Members

DepthEnable

Specifies whether to enable depth testing. Set this member to TRUE to enable depth testing.

DepthWriteMask

A D3D12_DEPTH_WRITE_MASK-typed value that identifies a portion of the depth-stencil buffer that can be modified by depth data.

DepthFunc

A D3D12_COMPARISON_FUNC-typed value that identifies a function that compares depth data against existing depth data.

StencilEnable

Specifies whether to enable stencil testing. Set this member to TRUE to enable stencil testing.

StencilReadMask

Identify a portion of the depth-stencil buffer for reading stencil data.

StencilWriteMask

Identify a portion of the depth-stencil buffer for writing stencil data.

FrontFace

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

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.

State Default Value
DepthEnable TRUE
DepthWriteMask D3D12_DEPTH_WRITE_MASK_ALL
DepthFunc D3D12_COMPARISON_FUNC_LESS
StencilEnable FALSE
StencilReadMask D3D12_DEFAULT_STENCIL_READ_MASK
StencilWriteMask D3D12_DEFAULT_STENCIL_WRITE_MASK
FrontFace.StencilFailOp

and

BackFace.StencilFailOp

D3D12_STENCIL_OP_KEEP
FrontFace.StencilDepthFailOp

and

BackFace.StencilDepthFailOp

D3D12_STENCIL_OP_KEEP
FrontFace.StencilPassOp

and

BackFace.StencilPassOp

D3D12_STENCIL_OP_KEEP
FrontFace.StencilFunc

and

BackFace.StencilFunc

D3D12_COMPARISON_FUNC_ALWAYS
 

The formats that support stenciling are DXGI_FORMAT_D24_UNORM_S8_UINT and DXGI_FORMAT_D32_FLOAT_S8X24_UINT.

Requirements

Requirement Value
Header d3d12.h

See also

CD3DX12_DEPTH_STENCIL_DESC

Core Structures