Files
XCEngine/docs/api/rhi/d3d12/command-list/clear-depth-stencil-view.md

35 lines
999 B
Markdown
Raw Normal View History

# D3D12CommandList::ClearDepthStencilView
清除深度模板视图(句柄重载)。
```cpp
void ClearDepthStencilView(D3D12_CPU_DESCRIPTOR_HANDLE depthStencilHandle, uint32_t clearFlags, float depth = 1.0f, uint8_t stencil = 0, uint32_t rectCount = 0, const D3D12_RECT* rects = nullptr);
```
## 参数
- `depthStencilHandle` - 深度模板视图 CPU 句柄
- `clearFlags` - 清除标志D3D12_CLEAR_FLAG_DEPTH / D3D12_CLEAR_FLAG_STENCIL
- `depth` - 深度值默认1.0f
- `stencil` - 模板值默认0
- `rectCount` - 矩形数量默认为0表示整个资源
- `rects` - 要清除的矩形数组默认为nullptr表示整个资源
## 返回值
**线程安全:** ❌
**复杂度:** O(n)
## 示例
```cpp
commandList.ClearDepthStencilView(depthStencilHandle, D3D12_CLEAR_FLAG_DEPTH | D3D12_CLEAR_FLAG_STENCIL, 1.0f, 0);
```
## 相关文档
- [D3D12CommandList 总览](command-list.md)
- [ClearDepthStencil](clear-depth-stencil.md) - 清除深度模板