refactor(app): compose atomic frame roots

Move the complete update/render construction graph into a typed Phase-8 owner, explicitly carry the content dependencies it consumes, and publish both roots through one exact lease. Extract lifecycle resource sampling and frame-owned late bindings so partial startup and shutdown withdraw the same generation without window callbacks.

Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-22 19:02:08 +02:00
parent 826f9ea9b5
commit 3628aeb520
21 changed files with 1052 additions and 374 deletions

View file

@ -46,6 +46,7 @@ public sealed class GameWindowRenderLeafCompositionTests
"Composition",
"SessionPlayerComposition.cs"));
string source = GameWindowSource();
string framePhase = FrameRootSource();
AssertAppearsInOrder(
phase,
@ -57,10 +58,13 @@ public sealed class GameWindowRenderLeafCompositionTests
AssertAppearsInOrder(
source,
"new SessionPlayerCompositionPhase(",
"new AcDream.App.Rendering.LocalPlayerTeleportRenderStateSource(",
"new AcDream.App.Rendering.RenderFrameResourceController(",
"new AcDream.App.Rendering.PrivatePresentationRenderer(",
"new AcDream.App.Rendering.RenderFrameOrchestrator(");
"new FrameRootCompositionPhase(");
AssertAppearsInOrder(
framePhase,
"new LocalPlayerTeleportRenderStateSource(",
"new RenderFrameResourceController(",
"new PrivatePresentationRenderer(",
"new RenderFrameOrchestrator(");
}
[Fact]
@ -111,10 +115,11 @@ public sealed class GameWindowRenderLeafCompositionTests
"Composition",
"SettingsDevToolsComposition.cs"));
Assert.Contains("new DevToolsFramePresenter(", settingsComposition);
Assert.Contains("new AcDream.App.Rendering.RenderFrameResourceController(", source);
Assert.Contains("new AcDream.App.Rendering.RenderWeatherFrameController(", source);
Assert.Contains("new AcDream.App.Rendering.PrivatePresentationRenderer(", source);
Assert.Contains("new AcDream.App.Rendering.RenderFrameOrchestrator(", source);
string framePhase = FrameRootSource();
Assert.Contains("new RenderFrameResourceController(", framePhase);
Assert.Contains("new RenderWeatherFrameController(", framePhase);
Assert.Contains("new PrivatePresentationRenderer(", framePhase);
Assert.Contains("new RenderFrameOrchestrator(", framePhase);
Assert.Contains("new DisplayFramePacingController(", source);
string pointerSource = File.ReadAllText(Path.Combine(
FindRepoRoot(),
@ -142,7 +147,8 @@ public sealed class GameWindowRenderLeafCompositionTests
AssertAppearsInOrder(
source,
"new ResourceShutdownStage(\"frame borrowers\"",
"_frameGraphs.Withdraw();",
"publication.Dispose();",
"bindings.Dispose();",
"new ResourceShutdownStage(\"session dependents\"");
AssertAppearsInOrder(
source,
@ -150,7 +156,7 @@ public sealed class GameWindowRenderLeafCompositionTests
"new(\"frame profiler\", _frameProfiler.Dispose)");
AssertAppearsInOrder(
source,
"_frameGraphs.Withdraw();",
"publication.Dispose();",
"owner.DisposeFrontend()",
"new ResourceShutdownStage(\"input\"",
"_input?.Dispose();",
@ -186,7 +192,7 @@ public sealed class GameWindowRenderLeafCompositionTests
"private void OnRender(double deltaSeconds)",
StringComparison.Ordinal);
int end = source.IndexOf(
"private AcDream.App.Diagnostics.WorldLifecycleResourceSnapshot",
"private void OnFramebufferResize(",
start,
StringComparison.Ordinal);
Assert.True(start >= 0 && end > start);
@ -216,12 +222,12 @@ public sealed class GameWindowRenderLeafCompositionTests
[Fact]
public void TerrainAndFrameDiagnostics_AreComposedAsOneFocusedOwner()
{
string source = GameWindowSource();
string source = FrameRootSource();
Assert.Contains(
"new AcDream.App.Rendering.TerrainDrawDiagnosticsController(",
"new TerrainDrawDiagnosticsController(",
source);
Assert.Contains("new AcDream.App.Rendering.WorldScenePassExecutor(", source);
Assert.Contains("new WorldScenePassExecutor(", source);
Assert.DoesNotContain("_terrainDrawDiagnostics!.Begin();", source);
Assert.DoesNotContain("_terrainDrawDiagnostics.Complete();", source);
}
@ -240,6 +246,13 @@ public sealed class GameWindowRenderLeafCompositionTests
"Composition",
"LivePresentationComposition.cs"));
private static string FrameRootSource() => File.ReadAllText(Path.Combine(
FindRepoRoot(),
"src",
"AcDream.App",
"Composition",
"FrameRootComposition.cs"));
private static string Source(string fileName) => File.ReadAllText(Path.Combine(
FindRepoRoot(),
"src",