Files
XCEngine/docs/api/rhi/d3d12/common/create-depth-stencil-clear-value.md
2026-03-20 02:35:45 +08:00

36 lines
716 B
Markdown

# D3D12Common::CreateDepthStencilClearValue
```cpp
inline D3D12_CLEAR_VALUE CreateDepthStencilClearValue(
DXGI_FORMAT format,
float depth = 1.0f,
uint8_t stencil = 0
)
```
创建深度模板缓冲区的清除值。
**参数:**
- `format` - 深度模板格式
- `depth` - 深度值,默认为 1.0f
- `stencil` - 模板值,默认为 0
**返回:** 配置好的 `D3D12_CLEAR_VALUE` 结构
**线程安全:** ✅(纯函数)
**示例:**
```cpp
D3D12_CLEAR_VALUE clearValue = CreateDepthStencilClearValue(
DXGI_FORMAT_D24_UNORM_S8_UINT,
1.0f,
0
);
```
## 相关文档
- [D3D12Common 总览](common.md)
- [CreateRenderTargetClearValue](create-render-target-clear-value.md)