refactor(srp): unify main-scene feature injection

This commit is contained in:
2026-04-22 02:15:03 +08:00
parent 36c4ae414b
commit 9b4a302f6a
7 changed files with 198 additions and 35 deletions

View File

@@ -0,0 +1,73 @@
# SRP / URP Main Scene Feature Injection Plan
时间2026-04-22
## 背景
当前 renderer block 主线已经基本清晰:
- `ShadowCaster`
- `DepthPrepass`
- `MainScene`
- `PostProcess`
- `FinalOutput`
`UniversalRenderer` 也已经拆出了对应 block owner。
`main scene` 这一面的 renderer feature 注入还不够干净:
1. `RenderObjectsRendererFeature` 自己手写 scene-stage 与 pass-stage 判断。
2. `BuiltinGaussianSplatRendererFeature` / `BuiltinVolumetricRendererFeature` 各自重复一套 native scene feature pass 注入逻辑。
3. 缺少统一的 main-scene feature 注入骨架,后续继续加 scene feature 时还会复制这些判断和样板。
## 本阶段目标
补齐 `main scene` feature 注入的统一 utility / controller把当前散落在 feature 里的 main-scene 注入规则收口。
目标结果:
1. `RenderObjectsRendererFeature` 走统一的 main-scene pass 注入 helper。
2. Gaussian / Volumetric 共用同一套 native scene feature controller。
3. 后续再加 main-scene renderer feature 时,有稳定的落点可复用。
## 范围
本阶段只处理 main-scene feature 注入骨架,不做:
- public renderer feature API 改造
- deferred rendering
- C++ host / RenderGraph 改造
## 实施步骤
### 1. 新增 main-scene feature 注入 utility
职责:
- 统一判断当前是否处于 main scene stage
- 统一判断 pass 是否属于当前 stage
- 统一执行 enqueue
### 2. 新增 native scene feature controller
职责:
- 持有 `NativeSceneFeaturePass`
- 统一 create / configure / enqueue
- 供 Gaussian / Volumetric 复用
### 3. 接入现有 feature
接入:
- `RenderObjectsRendererFeature`
- `BuiltinGaussianSplatRendererFeature`
- `BuiltinVolumetricRendererFeature`
## 完成标准
满足以下条件才算本阶段收口:
1. main-scene feature 注入规则不再散落在多个 feature 里重复实现。
2. Gaussian / Volumetric 共用统一 native scene feature controller。
3. `XCEditor` 编译通过old editor 冒烟通过。