Files
XCEngine/docs/api/XCEngine/Rendering/SceneRenderer/SetPipelineAsset.md

35 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# SceneRenderer::SetPipelineAsset
切换当前场景渲染器使用的 pipeline asset。
```cpp
void SetPipelineAsset(std::shared_ptr<const RenderPipelineAsset> pipelineAsset);
```
## 参数
- `pipelineAsset` - 目标 pipeline asset允许传入空指针。
## 当前语义
- 当前实现直接转发到内部 `m_cameraRenderer.SetPipelineAsset(...)`
- 如果传入 asset 非空,后续 runtime pipeline 会由该 asset 创建。
- 如果传入 asset 为空,内部会回退到默认 builtin forward pipeline asset而不是保留空绑定。
- 被替换掉的旧 runtime pipeline 会先执行 `Shutdown()`,再由新 asset 创建新实例。
## 调用方影响
- 调用之后,[GetPipelineAsset](GetPipelineAsset.md) 和 [GetPipeline](GetPipeline.md) 的返回值都可能变化。
- 任何此前缓存的旧 pipeline 指针都应视为潜在失效。
- 如果调用方只是想直接接管 runtime pipeline而不是保留 asset 工厂关系,应改用 [SetPipeline](SetPipeline.md)。
## 测试覆盖
- `tests/Rendering/unit/test_camera_scene_renderer.cpp` 验证了替换 asset 时旧 pipeline 会被 `Shutdown()`,并且新 asset 会创建新的 runtime pipeline 实例。
## 相关文档
- [SceneRenderer](SceneRenderer.md)
- [SetPipeline](SetPipeline.md)
- [GetPipelineAsset](GetPipelineAsset.md)