refactor(srp): remove managed backend key binding detour

This commit is contained in:
2026-04-21 18:46:43 +08:00
parent ed738475fe
commit 01b5e0abcd
8 changed files with 76 additions and 157 deletions

View File

@@ -0,0 +1,63 @@
# SRP URP Default Native Renderer Binding Plan
Date: 2026-04-21
## Goal
Remove the remaining managed backend-key declaration path from current URP
renderer data and make native scene-renderer binding fall back to an internal
default native renderer asset instead of asking managed C# for a string key.
This keeps the native renderer substrate in C++, but stops routing current URP
through a Unity-unlike `"BuiltinForward"` key callback.
## Why This Stage
After the previous SRP cleanup:
1. managed standalone-pass asset keys are gone;
2. managed URP owns camera request, frame planning, render-scene setup,
shadow/depth stage composition, and stage recording;
3. the remaining managed/native backend seam is
`GetPipelineRendererAssetKey*()`.
Current repo state shows:
1. `UniversalRendererData` still returns `"BuiltinForward"` from managed C#;
2. `MonoManagedRenderPipelineAssetRuntime` still resolves that method name and
converts the string key back into a native asset;
3. the only active builtin backend is still the default forward renderer
substrate.
So the current C# backend-key hop is not buying real flexibility. It is mostly
an internal detour that keeps Unity-unlike ownership in the current URP path.
## Scope
Included:
1. add an internal helper that resolves the default native pipeline renderer
asset in C++;
2. remove `GetPipelineRendererAssetKey*()` from current managed URP C# types;
3. remove the corresponding Mono method-resolution / invocation bridge;
4. make `MonoManagedRenderPipelineAssetRuntime::GetPipelineRendererAsset(...)`
use the internal default native renderer asset;
5. rebuild `XCEditor` and run old editor smoke.
Not included:
1. redesigning `NativeSceneRecorder` itself;
2. introducing deferred native scene renderer backends;
3. changing public SRP authoring APIs;
4. moving scene draw implementation out of C++.
## Done Criteria
1. current URP managed code no longer returns native backend keys;
2. Mono runtime no longer resolves `GetPipelineRendererAssetKey*()` from
managed assets;
3. managed SRP host / stage recorder still binds a valid native scene renderer
substrate through internal default binding;
4. `cmake --build . --config Debug --target XCEditor` passes;
5. old editor smoke passes for at least about 10 seconds and a fresh
`SceneReady` appears in `editor/bin/Debug/editor.log`.