Files
XCEngine/docs/api/XCEngine/Rendering/RenderSurface/GetDepthStateBefore.md

34 lines
1.3 KiB
Markdown
Raw Normal View History

# RenderSurface::GetDepthStateBefore
返回深度附件进入本次渲染前预期所处的状态。
```cpp
RHI::ResourceStates GetDepthStateBefore() const;
```
## 返回值
- 返回内部保存的深度附件“起始状态”;默认值是 `DepthWrite`
## 当前语义
- 这不是逐资源的真实状态查询,而是 `RenderSurface` 暴露给调用方和 builtin pass 的契约值。
- 当 [IsAutoTransitionEnabled](IsAutoTransitionEnabled.md) 为 `true`主场景、depth-style 与 object-id 这些路径会把它作为深度附件进入本次 pass 前的 barrier 来源状态。
- `SceneRenderer` 在复用深度附件构造 fullscreen 阶段 surface 时,也会保留这个值。
## 调用方影响
- 如果调用方关闭自动状态切换,就必须自己保证深度附件真的处于这里声明的状态。
- 这个值通常和 [GetDepthStateAfter](GetDepthStateAfter.md) 配对出现,用来描述同一块深度资源在本阶段前后的状态约定。
## 测试覆盖
- `tests/Rendering/unit/test_builtin_forward_pipeline.cpp`
- `tests/Rendering/unit/test_camera_scene_renderer.cpp`
## 相关文档
- [RenderSurface](RenderSurface.md)
- [SetDepthStateBefore](SetDepthStateBefore.md)
- [GetDepthStateAfter](GetDepthStateAfter.md)
- [IsAutoTransitionEnabled](IsAutoTransitionEnabled.md)