35 lines
880 B
Markdown
35 lines
880 B
Markdown
# RHICommandList::SetDepthStencilState
|
|
|
|
```cpp
|
|
virtual void SetDepthStencilState(const DepthStencilState& state) = 0;
|
|
```
|
|
|
|
设置深度测试和模板测试的状态配置。控制像素是否根据深度值和模板值被丢弃。
|
|
|
|
**参数:**
|
|
- `state` - 深度模板状态结构体(包含 depthEnable、depthWriteMask、depthFunc、stencilEnable 等)
|
|
|
|
**返回:** `void`
|
|
|
|
**异常:** 无
|
|
|
|
**线程安全:** ❌
|
|
|
|
**复杂度:** O(1)
|
|
|
|
**示例:**
|
|
|
|
```cpp
|
|
DepthStencilState dsState;
|
|
dsState.depthEnable = true;
|
|
dsState.depthWriteMask = true;
|
|
dsState.depthFunc = ComparisonFunc::Less;
|
|
dsState.stencilEnable = false;
|
|
cmdList->SetDepthStencilState(dsState);
|
|
```
|
|
|
|
## 相关文档
|
|
|
|
- [RHICommandList 总览](command-list.md) - 返回类总览
|
|
- [SetStencilRef](set-stencil-ref.md) - 设置模板参考值
|
|
- [SetPipelineState](set-pipeline-state.md) - 设置管线状态 |