docs: sync viewport render flow and builtin pass docs

This commit is contained in:
2026-04-04 16:51:39 +08:00
parent 8d715eb40f
commit b9cde699cc
19 changed files with 377 additions and 205 deletions

View File

@@ -1,24 +1,43 @@
# BuiltinObjectIdPass::BuildInputLayout
返回 builtin object-id pass 当前使用的静态顶点布局。
```cpp
static RHI::InputLayoutDesc BuildInputLayout();
```
## 行为说明
## 当前实现返回值
当前实现只声明一个顶点元素:
当前实现会按 `Resources::StaticMeshVertex` 的字段顺序构造 3 个输入元素:
- `POSITION`
- `semanticIndex = 0`
- `Format::R32G32B32_Float`
- 偏移取自 `Resources::StaticMeshVertex::position`
1. `POSITION`
- `semanticIndex = 0`
- `format = R32G32B32_Float`
- `inputSlot = 0`
- `alignedByteOffset = offsetof(Resources::StaticMeshVertex, position)`
2. `NORMAL`
- `semanticIndex = 0`
- `format = R32G32B32_Float`
- `inputSlot = 0`
- `alignedByteOffset = offsetof(Resources::StaticMeshVertex, normal)`
3. `TEXCOORD`
- `semanticIndex = 0`
- `format = R32G32_Float`
- `inputSlot = 0`
- `alignedByteOffset = offsetof(Resources::StaticMeshVertex, uv0)`
## 当前语义
- object-id pass 只依赖顶点位置不读取法线、UV、切线或颜色
-和当前 shader 语义一致,因为它只需要做几何覆盖并输出 object-id 颜色
- 这不是“只包含位置”的极简布局;当前 object-id pass 仍然沿用静态网格常用的 `POSITION / NORMAL / TEXCOORD0` 输入契约
-样构建出来的 pipeline 能直接消费 `RenderResourceCache` 上传的 `StaticMeshVertex` 顶点流,而不需要为 object-id 路径单独准备另一套顶点缓冲描述
- 资源绑定层面上object-id pass 只要求 `PerObject` 常量缓冲;这和顶点布局是两个独立维度。
## 测试覆盖
- `tests/Rendering/unit/test_builtin_forward_pipeline.cpp` 显式验证了这里返回的 3 个输入元素及其 offset。
## 相关文档
- [BuiltinObjectIdPass](BuiltinObjectIdPass.md)
- [Render](Render.md)
- [ObjectIdEncoding](../../ObjectIdEncoding/ObjectIdEncoding.md)