D3D11_DEPTH_STENCIL_DESC structure (d3d11.h)
Describes depth-stencil state.
Syntax
typedef struct D3D11_DEPTH_STENCIL_DESC {
BOOL DepthEnable;
D3D11_DEPTH_WRITE_MASK DepthWriteMask;
D3D11_COMPARISON_FUNC DepthFunc;
BOOL StencilEnable;
UINT8 StencilReadMask;
UINT8 StencilWriteMask;
D3D11_DEPTH_STENCILOP_DESC FrontFace;
D3D11_DEPTH_STENCILOP_DESC BackFace;
} D3D11_DEPTH_STENCIL_DESC;
Members
DepthEnable
Type: BOOL
Enable depth testing.
DepthWriteMask
Type: D3D11_DEPTH_WRITE_MASK
Identify a portion of the depth-stencil buffer that can be modified by depth data (see D3D11_DEPTH_WRITE_MASK).
DepthFunc
Type: D3D11_COMPARISON_FUNC
A function that compares depth data against existing depth data. The function options are listed in D3D11_COMPARISON_FUNC.
StencilEnable
Type: BOOL
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: D3D11_DEPTH_STENCILOP_DESC
Identify how to use the results of the depth test and the stencil test for pixels whose surface normal is facing towards the camera (see D3D11_DEPTH_STENCILOP_DESC).
BackFace
Type: D3D11_DEPTH_STENCILOP_DESC
Identify how to use the results of the depth test and the stencil test for pixels whose surface normal is facing away from the camera (see D3D11_DEPTH_STENCILOP_DESC).
Remarks
Pass a pointer to D3D11_DEPTH_STENCIL_DESC to the ID3D11Device::CreateDepthStencilState method to create the depth-stencil state object.
Depth-stencil state controls how depth-stencil testing is performed by the output-merger stage.
The following table shows the default values of depth-stencil states.
State | Default Value |
---|---|
DepthEnable | TRUE |
DepthWriteMask | D3D11_DEPTH_WRITE_MASK_ALL |
DepthFunc | D3D11_COMPARISON_LESS |
StencilEnable | FALSE |
StencilReadMask | D3D11_DEFAULT_STENCIL_READ_MASK |
StencilWriteMask | D3D11_DEFAULT_STENCIL_WRITE_MASK |
FrontFace.StencilFunc
and BackFace.StencilFunc |
D3D11_COMPARISON_ALWAYS |
FrontFace.StencilDepthFailOp
and BackFace.StencilDepthFailOp |
D3D11_STENCIL_OP_KEEP |
FrontFace.StencilPassOp
and BackFace.StencilPassOp |
D3D11_STENCIL_OP_KEEP |
FrontFace.StencilFailOp
and BackFace.StencilFailOp |
D3D11_STENCIL_OP_KEEP |
The formats that support stenciling are DXGI_FORMAT_D24_UNORM_S8_UINT and DXGI_FORMAT_D32_FLOAT_S8X24_UINT.
Requirements
Requirement | Value |
---|---|
Header | d3d11.h |