refactor(srp): clear legacy fullscreen stages before managed planning

This commit is contained in:
2026-04-21 13:12:43 +08:00
parent 2d4ff384fd
commit 40bf945cef
2 changed files with 66 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
# SRP Universal Managed Fullscreen Planning Ownership Plan 2026-04-21
## Goal
Make renderer-backed managed pipelines explicitly own fullscreen stage planning by clearing native legacy fullscreen stage state before managed renderer planning runs.
## Why This Stage
The previous stage removed renderer-level fullscreen heuristics, but one legacy seam is still present:
1. native camera-frame policy can prebuild post-process and final-output fullscreen state;
2. managed URP then reshapes or replaces that state later;
3. ownership is therefore still mixed during plan construction.
For a Unity-style SRP/URP direction, renderer-backed managed assets should start from a clean fullscreen-stage slate and let managed renderer data/features re-declare the stages they need.
## Scope
Included:
1. clear legacy `PostProcess` and `FinalOutput` stage state at the start of renderer-backed managed planning;
2. keep this behavior overridable in the renderer-backed asset base;
3. rebuild `XCEditor` and run old editor smoke.
Not included:
1. removing native final-color policy resolution;
2. deleting native fullscreen pass implementations;
3. deleting legacy fullscreen planning for non-managed pipelines;
4. deferred renderer work.
## Acceptance
This stage is complete when:
1. renderer-backed managed pipelines begin planning with cleared legacy fullscreen stage state;
2. managed URP still reconstructs the required fullscreen stages through renderer features;
3. `XCEditor` build passes;
4. old editor smoke passes and `editor.log` contains a fresh `SceneReady`.
## Validation
Validated on 2026-04-21:
1. built old editor target with `cmake --build . --config Debug --target XCEditor` from `build/`;
2. launched `editor/bin/Debug/XCEngine.exe` for about 12 seconds;
3. verified fresh `editor/bin/Debug/editor.log` contains `SceneReady`.
Observed log line:
`[2026-04-21 13:11:41] [INFO] [General] [SceneLoadTrace] SceneReady elapsed_ms=6597 first_frame_ms=757 peak_pending_async=9`

View File

@@ -51,6 +51,16 @@ namespace XCEngine.Rendering.Universal
protected override void ConfigureCameraFramePlan(
ScriptableRenderPipelinePlanningContext context)
{
if (UsesExplicitFullscreenStagePlanning() &&
context != null)
{
// Renderer-backed SRP owns fullscreen stage planning explicitly.
context.ClearFullscreenStage(
CameraFrameStage.PostProcess);
context.ClearFullscreenStage(
CameraFrameStage.FinalOutput);
}
ScriptableRendererData resolvedRendererData =
ResolveRendererData(context);
if (resolvedRendererData != null)
@@ -220,6 +230,11 @@ namespace XCEngine.Rendering.Universal
return null;
}
protected virtual bool UsesExplicitFullscreenStagePlanning()
{
return true;
}
internal ScriptableRendererData GetDefaultRendererData()
{
return ResolveSelectedRendererData();