docs(rendering): sync render surface state and sample docs

This commit is contained in:
2026-04-10 18:08:37 +08:00
parent 85b8b3e583
commit 0602b34652
8 changed files with 248 additions and 26 deletions

View File

@@ -0,0 +1,33 @@
# 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)