perf(streaming): cursor publication across frame budgets
This commit is contained in:
parent
bb16f74fd4
commit
98f1ac8934
32 changed files with 2215 additions and 823 deletions
|
|
@ -56,6 +56,73 @@ public sealed class LandblockConcretePresentationPipelineTests
|
|||
Assert.Equal(1, fixture.Static.Diagnostics.CompleteCount);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MeteredLoaded_RetainsExactHeadAndPublishesSpatiallyOnlyAfterOwnerSuffix()
|
||||
{
|
||||
var calls = new List<string>();
|
||||
ConcreteFixture fixture = Fixture(
|
||||
calls,
|
||||
commitEnvCells: _ => calls.Add("envcell"));
|
||||
fixture.Events.EntitySpawned += _ => calls.Add("plugin");
|
||||
var pipeline = new LandblockPresentationPipeline(
|
||||
fixture.Render,
|
||||
fixture.Physics,
|
||||
fixture.Static,
|
||||
fixture.State,
|
||||
fixture.RetirementOwner,
|
||||
onLandblockLoaded: _ => calls.Add("live-recovery"));
|
||||
LandblockStreamResult.Loaded result =
|
||||
Result(Build(Entity(0x80A9B401u), Entity(0x80A9B402u)));
|
||||
LandblockStreamCostEstimate estimate =
|
||||
LandblockStreamResultCost.Estimate(result);
|
||||
var budget = new StreamingWorkBudget(
|
||||
TimeSpan.FromSeconds(1),
|
||||
maxCompletionAdmissions: 64,
|
||||
maxAdoptedCpuBytes: 1_000_000,
|
||||
maxEntityOperations: 1,
|
||||
maxGpuUploadBytes: 1_000_000,
|
||||
maxGlRetireOperations: 64,
|
||||
destinationReserveFraction: 0.75f);
|
||||
|
||||
LandblockPublicationAdvance advance = default;
|
||||
for (int frame = 0; frame < 64; frame++)
|
||||
{
|
||||
var meter = new StreamingWorkMeter(budget);
|
||||
advance = frame == 0
|
||||
? pipeline.PublishLoaded(
|
||||
result,
|
||||
estimate,
|
||||
meter,
|
||||
ensureProgress: false)
|
||||
: pipeline.ResumePublication(
|
||||
result,
|
||||
meter,
|
||||
ensureProgress: false);
|
||||
meter.FinishFrame();
|
||||
|
||||
Assert.True(
|
||||
meter.Snapshot.Used.EntityOperations <= 1,
|
||||
$"stage={meter.Snapshot.LastStage}, " +
|
||||
$"entities={meter.Snapshot.Used.EntityOperations}, " +
|
||||
$"oversized={meter.Snapshot.OversizedProgressCount}");
|
||||
if (fixture.Static.Diagnostics.CompleteCount == 0)
|
||||
Assert.False(fixture.State.IsLoaded(LandblockId));
|
||||
if (advance.Completed)
|
||||
break;
|
||||
}
|
||||
|
||||
Assert.True(advance.Completed);
|
||||
Assert.False(pipeline.HasPendingPublication(result));
|
||||
Assert.True(fixture.State.IsNearTier(LandblockId));
|
||||
Assert.Equal(
|
||||
["terrain", "envcell", "plugin", "plugin", "pin", "live-recovery"],
|
||||
calls);
|
||||
Assert.Equal(1, fixture.Render.Diagnostics.BeginCount);
|
||||
Assert.Equal(1, fixture.Physics.Diagnostics.BeginCount);
|
||||
Assert.Equal(1, fixture.Physics.Diagnostics.CompleteCount);
|
||||
Assert.Equal(1, fixture.Static.Diagnostics.CompleteCount);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RenderSuffixFailure_ResumesConcreteReceiptsWithoutReplayingPrefixes()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue