Files
XCEngine/docs/api/XCEngine/Rendering/Passes/BuiltinObjectIdPass/BuildInputLayout.md

1.5 KiB
Raw Blame History

BuiltinObjectIdPass::BuildInputLayout

返回 builtin object-id pass 当前使用的静态顶点布局。

static RHI::InputLayoutDesc BuildInputLayout();

当前实现返回值

当前实现会按 Resources::StaticMeshVertex 的字段顺序构造 3 个输入元素:

  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 仍然沿用静态网格常用的 POSITION / NORMAL / TEXCOORD0 输入契约。
  • 这样构建出来的 pipeline 能直接消费 RenderResourceCache 上传的 StaticMeshVertex 顶点流,而不需要为 object-id 路径单独准备另一套顶点缓冲描述。
  • 资源绑定层面上object-id pass 只要求 PerObject 常量缓冲;这和顶点布局是两个独立维度。

测试覆盖

  • tests/Rendering/unit/test_builtin_forward_pipeline.cpp 显式验证了这里返回的 3 个输入元素及其 offset。

相关文档