feat(app): observe canonical placement receipts
This commit is contained in:
parent
378ca95a67
commit
f05ed5c3cd
14 changed files with 545 additions and 31 deletions
|
|
@ -1,9 +1,11 @@
|
|||
using System.Reflection;
|
||||
using AcDream.App.Rendering;
|
||||
using AcDream.App.Net;
|
||||
using AcDream.App.Streaming;
|
||||
using AcDream.App.Update;
|
||||
using AcDream.App.World;
|
||||
using AcDream.Runtime;
|
||||
using AcDream.Runtime.Session;
|
||||
using AcDream.Runtime.World;
|
||||
|
||||
namespace AcDream.App.Tests.World;
|
||||
|
|
@ -387,6 +389,65 @@ public sealed class UpdateFrameOrchestratorTests
|
|||
Assert.Equal(1, CountOccurrences(source, "_scripts.Tick("));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PlacementRetryRunsAfterStreamingAndInboundBeforeCommandReconcile()
|
||||
{
|
||||
string root = FindRepoRoot();
|
||||
string outer = File.ReadAllText(Path.Combine(
|
||||
root,
|
||||
"src",
|
||||
"AcDream.App",
|
||||
"Update",
|
||||
"UpdateFrameOrchestrator.cs"));
|
||||
string live = File.ReadAllText(Path.Combine(
|
||||
root,
|
||||
"src",
|
||||
"AcDream.App",
|
||||
"World",
|
||||
"RetailLiveFrameCoordinator.cs"));
|
||||
|
||||
AssertAppearsInOrder(
|
||||
outer,
|
||||
"_streaming.Tick();",
|
||||
"_liveFrame.Tick(");
|
||||
AssertAppearsInOrder(
|
||||
live,
|
||||
"_session.Tick();",
|
||||
"_placementProjectionRetry?.RetryPending();",
|
||||
"_localPlayer.RunPostNetworkCommandPhase();",
|
||||
"_spatialReconciler.Reconcile();");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(true)]
|
||||
[InlineData(false)]
|
||||
public void LiveFrameRetriesPlacementAfterInboundEvenWhenWorldIsQuiesced(
|
||||
bool worldAvailable)
|
||||
{
|
||||
var calls = new List<string>();
|
||||
var phases = new RecordingLivePhases(calls)
|
||||
{
|
||||
IsWorldAvailable = worldAvailable,
|
||||
};
|
||||
var frame = new RetailLiveFrameCoordinator(
|
||||
phases,
|
||||
new GpuWorldState(),
|
||||
phases,
|
||||
phases,
|
||||
phases,
|
||||
phases,
|
||||
phases,
|
||||
phases);
|
||||
|
||||
frame.Tick(1f / 60f);
|
||||
|
||||
Assert.Equal(
|
||||
worldAvailable
|
||||
? ["objects", "network", "placement-retry", "commands", "reconcile"]
|
||||
: ["network", "placement-retry", "commands", "render-sync"],
|
||||
calls);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GameWindow_ComposesTheLiveFrameOwnersWithoutOwningTheirBodies()
|
||||
{
|
||||
|
|
@ -1048,6 +1109,26 @@ public sealed class UpdateFrameOrchestratorTests
|
|||
}
|
||||
}
|
||||
|
||||
private sealed class RecordingLivePhases(List<string> calls) :
|
||||
ILiveObjectFramePhase,
|
||||
IRuntimeLiveSessionFramePhase,
|
||||
IPostNetworkCommandFramePhase,
|
||||
ILiveSpatialReconcilePhase,
|
||||
IRenderProjectionSyncPhase,
|
||||
IWorldGenerationAvailability,
|
||||
IRuntimePlacementProjectionRetryPhase
|
||||
{
|
||||
public bool IsWorldAvailable { get; set; }
|
||||
public long QuiescedGeneration => IsWorldAvailable ? 0L : 1L;
|
||||
|
||||
public void Tick(float deltaSeconds) => calls.Add("objects");
|
||||
public void Tick() => calls.Add("network");
|
||||
public void RunPostNetworkCommandPhase() => calls.Add("commands");
|
||||
public void Reconcile() => calls.Add("reconcile");
|
||||
public void SynchronizeActiveSources() => calls.Add("render-sync");
|
||||
public void RetryPending() => calls.Add("placement-retry");
|
||||
}
|
||||
|
||||
private sealed class RecordingCommit(List<string> calls)
|
||||
: IUpdateFrameCommitPhase
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue