> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# D3D12_DEPTH_STENCILOP_DESC

> 描述可根据模板测试结果执行的模板操作。

描述可根据模板测试结果执行的模板操作。

## 语法

```cpp theme={null}
typedef struct D3D12_DEPTH_STENCILOP_DESC
{
    D3D12_STENCIL_OP StencilFailOp;
    D3D12_STENCIL_OP StencilDepthFailOp;
    D3D12_STENCIL_OP StencilPassOp;
    D3D12_COMPARISON_FUNC StencilFunc;
} D3D12_DEPTH_STENCILOP_DESC
```

### 成员

*StencilFailOp*\
类型:D3D12\_STENCIL\_OP

一个 [D3D12\_STENCIL\_OP](/reference/graphics/d3d12_x/enums/d3d12_stencil_op) 类型的值,用于标识模板测试失败时要执行的模板操作。

*StencilDepthFailOp*\
类型:D3D12\_STENCIL\_OP

一个 [D3D12\_STENCIL\_OP](/reference/graphics/d3d12_x/enums/d3d12_stencil_op) 类型的值,用于标识当模板测试通过且深度测试失败时要执行的模板操作。

*StencilPassOp*\
类型:D3D12\_STENCIL\_OP

一个 [D3D12\_STENCIL\_OP](/reference/graphics/d3d12_x/enums/d3d12_stencil_op) 类型的值,用于标识模板测试和深度测试都通过时要执行的模板操作。

*StencilFunc*\
类型:D3D12\_COMPARISON\_FUNC

一个 [D3D12\_COMPARISON\_FUNC](/reference/graphics/d3d12/enums/d3d12_comparison_func_public) 类型的值,用于标识将模板数据与现有模板数据进行比较的函数。

## 备注

所有模板操作都指定为 [D3D12\_STENCIL\_OP](/reference/graphics/d3d12_x/enums/d3d12_stencil_op) 类型的值。可以根据模板测试的结果对每个模板操作进行不同的设置,该结果在深度模板测试的模板测试部分中称为 **StencilFunc**。

[D3D12\_DEPTH\_STENCIL\_DESC](/reference/graphics/d3d12/structs/d3d12_depth_stencil_desc_public) 的成员将此结构作为其数据类型。

## 要求

**头文件:** d3d12\_xs.h 或 d3d12\_x.h\
**库:** d3d12\_xs.lib 或 d3d12\_x.lib\
**支持的平台**:XBOX Series 主机和 XBOX One 系列

## 另请参阅

[核心结构](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/direct3d-12-structures)


## Related topics

- [D3D12_DEPTH_STENCIL_DESC](/zh-CN/reference/graphics/d3d12/structs/d3d12_depth_stencil_desc_public.md)
- [D3D12_DEPTH_STENCIL_DESC1](/zh-CN/reference/graphics/d3d12/structs/d3d12_depth_stencil_desc1_public.md)
- [D3D12_COMPARISON_FUNC](/zh-CN/reference/graphics/d3d12/enums/d3d12_comparison_func_public.md)
- [D3D12_DEPTH_STENCIL_VIEW_DESC](/zh-CN/reference/graphics/d3d12/structs/d3d12_depth_stencil_view_desc_public.md)
- [D3D12_RENDER_PASS_DEPTH_STENCIL_DESC](/zh-CN/reference/graphics/d3d12/structs/d3d12_render_pass_depth_stencil_desc_public.md)
