refactor(srp): bridge universal shadow planning settings into managed asset

- expose directional shadow planning settings on camera request context\n- let the managed universal asset override planner defaults\n- recompute native directional shadow requests only when settings change
This commit is contained in:
2026-04-21 02:19:30 +08:00
parent 5747968fc4
commit bfc4b90ce6
9 changed files with 380 additions and 5 deletions

View File

@@ -0,0 +1,42 @@
# SRP Universal Shadow Planning Settings Bridge Plan 2026-04-21
## Goal
Extend the current managed shadow ownership from a simple enable/disable switch to a real planning-settings bridge:
1. managed can read the current directional shadow planning settings;
2. managed can override those settings;
3. native recomputes the shadow request after managed overrides, without changing the existing call order.
## Why This Stage
The previous stage moved the first shadow ownership decision into `UniversalRenderPipelineAsset`, but it still only controlled whether shadows stay enabled.
The remaining gap is that native already receives `DirectionalShadowPlanningSettings`, while the managed runtime currently discards them. Until that bridge exists, URP cannot meaningfully own shadow planning defaults.
## Scope
Included:
1. Add managed mirror structs for directional shadow planning settings.
2. Expose those settings on `CameraRenderRequestContext` and `RendererCameraRequestContext`.
3. Extend the Mono bridge state to carry a mutable settings copy and a dirty flag.
4. Re-run native default shadow planning after managed request configuration when settings changed.
5. Let `UniversalShadowSettings` push its planning defaults into the request context.
6. Rebuild `XCEditor` and run old editor smoke.
Not included:
1. Shadow cascades.
2. Shadow atlas / multiple lights.
3. C# shadow map raster pass implementation.
4. Editor UI for shadow settings.
## Acceptance
This stage is complete when:
1. managed URP can override planner-owned main directional shadow defaults;
2. existing `ClearDirectionalShadow()` behavior still works;
3. the native shadow request is recomputed only when managed changed planning settings;
4. `XCEditor` build and old editor smoke both pass.