perf(rendering): reconcile only changed attachments
This commit is contained in:
parent
6b56f4bef2
commit
b9cbf5e040
8 changed files with 246 additions and 14 deletions
|
|
@ -257,6 +257,67 @@ public sealed class EquippedChildProjectionWithdrawalTests
|
|||
Assert.True(record.IsSpatiallyProjected);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PostNetworkReconcile_SkipsStableTree_AndUpdatesChangedBranchParentFirst()
|
||||
{
|
||||
using var fixture = new ControllerFixture((_, _, _) =>
|
||||
new(
|
||||
ExactProjectionWithdrawalDisposition.Completed,
|
||||
Failure: null));
|
||||
LiveEntityRecord root = fixture.Spawn(0x70000241u, generation: 1);
|
||||
LiveEntityRecord child = fixture.Spawn(
|
||||
0x70000242u,
|
||||
generation: 1,
|
||||
LiveEntityProjectionKind.Attached);
|
||||
LiveEntityRecord grandchild = fixture.Spawn(
|
||||
0x70000243u,
|
||||
generation: 1,
|
||||
LiveEntityProjectionKind.Attached);
|
||||
fixture.InstallAttached(root, child);
|
||||
fixture.InstallAttached(child, grandchild);
|
||||
fixture.Poses.Publish(root.WorldEntity!, Array.Empty<Matrix4x4>());
|
||||
|
||||
fixture.Controller.Tick();
|
||||
Assert.Equal(2, fixture.Controller.LastFullPoseCompositionVisits);
|
||||
|
||||
fixture.Controller.ReconcileSpatialMutations();
|
||||
Assert.Equal(0, fixture.Controller.LastReconcilePoseCompositionVisits);
|
||||
|
||||
root.WorldEntity!.SetPosition(new Vector3(7f, 8f, 9f));
|
||||
Assert.True(fixture.Poses.UpdateRoot(root.WorldEntity));
|
||||
fixture.Controller.ReconcileSpatialMutations();
|
||||
|
||||
Assert.Equal(2, fixture.Controller.LastReconcilePoseCompositionVisits);
|
||||
Assert.Equal(root.WorldEntity.Position, child.WorldEntity!.Position);
|
||||
Assert.Equal(child.WorldEntity.Position, grandchild.WorldEntity!.Position);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void StablePostNetworkReconcile_AllocatesNoTransitionSnapshots()
|
||||
{
|
||||
using var fixture = new ControllerFixture((_, _, _) =>
|
||||
new(
|
||||
ExactProjectionWithdrawalDisposition.Completed,
|
||||
Failure: null));
|
||||
LiveEntityRecord root = fixture.Spawn(0x70000244u, generation: 1);
|
||||
LiveEntityRecord child = fixture.Spawn(
|
||||
0x70000245u,
|
||||
generation: 1,
|
||||
LiveEntityProjectionKind.Attached);
|
||||
fixture.InstallAttached(root, child);
|
||||
fixture.Poses.Publish(root.WorldEntity!, Array.Empty<Matrix4x4>());
|
||||
fixture.Controller.Tick();
|
||||
fixture.Controller.ReconcileSpatialMutations();
|
||||
|
||||
long before = GC.GetAllocatedBytesForCurrentThread();
|
||||
for (int i = 0; i < 1_000; i++)
|
||||
fixture.Controller.ReconcileSpatialMutations();
|
||||
long allocated = GC.GetAllocatedBytesForCurrentThread() - before;
|
||||
|
||||
Assert.Equal(0L, allocated);
|
||||
Assert.Equal(0, fixture.Controller.LastReconcilePoseCompositionVisits);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AcceptedValidParent_WithdrawsWorldProjectionBeforePosePrerequisitesExist()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue