D3D12_DEPTH_STENCIL_DESC1 structure

Describes depth-stencil state.

Syntax

typedef struct D3D12_DEPTH_STENCIL_DESC1 {
  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;
  BOOL                       DepthBoundsTestEnable;
} D3D12_DEPTH_STENCIL_DESC1;

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.

DepthBoundsTestEnable

TRUE to enable depth-bounds testing; otherwise, FALSE. The default value is FALSE.

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_LESS
StencilEnable FALSE
StencilReadMask D3D12_DEFAULT_STENCIL_READ_MASK
StencilWriteMask D3D12_DEFAULT_STENCIL_WRITE_MASK
FrontFace.StencilFunc

and

BackFace.StencilFunc

D3D12_COMPARISON_ALWAYS
FrontFace.StencilDepthFailOp

and

BackFace.StencilDepthFailOp

D3D12_STENCIL_OP_KEEP
FrontFace.StencilPassOp

and

BackFace.StencilPassOp

D3D12_STENCIL_OP_KEEP
FrontFace.StencilFailOp

and

BackFace.StencilFailOp

D3D12_STENCIL_OP_KEEP
DepthBoundsTestEnable FALSE
 

The formats that support stenciling are DXGI_FORMAT_D24_UNORM_S8_UINT and DXGI_FORMAT_D32_FLOAT_S8X24_UINT.

Requirements

   
Header d3d12.h

See Also

Core Structures