fix(physics): make collision activation starvation-free
This commit is contained in:
parent
d94145e6b8
commit
6b28ff999c
14 changed files with 4637 additions and 474 deletions
|
|
@ -265,6 +265,13 @@ public sealed class LandblockPhysicsPublisher
|
|||
if (publication.PreparationCommitted)
|
||||
return true;
|
||||
|
||||
if (!_physics.AdvanceCollisionGenerationPreparation(
|
||||
publication.CollisionAdmission,
|
||||
publication.PreparedGeneration).Completed)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
IReadOnlyList<WorldEntity> entities =
|
||||
publication.Build.Landblock.Entities;
|
||||
if (publication.Build.Collisions is { } collisions)
|
||||
|
|
@ -548,7 +555,13 @@ public sealed class LandblockPhysicsPublisher
|
|||
publication.RefloodCommitted = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
// Seal reconciliation and the zero-work root transfer are one host
|
||||
// update-thread transaction. Deferring this commit to the next frame
|
||||
// would let continuously moving, unrelated live owners dirty their
|
||||
// already-visited journal slots forever even though each metered replay
|
||||
// had just caught up exactly.
|
||||
if (publication.SealCommitted && !publication.CompletionCommitted)
|
||||
{
|
||||
RuntimeCollisionGenerationCommit commit =
|
||||
_physics.CommitCollisionGeneration(
|
||||
|
|
@ -556,12 +569,9 @@ public sealed class LandblockPhysicsPublisher
|
|||
publication.PreparedGeneration);
|
||||
if (!commit.Committed)
|
||||
{
|
||||
_physics.RestartCollisionRetainedOwnerCapture(
|
||||
publication.CollisionAdmission,
|
||||
publication.PreparedGeneration);
|
||||
publication.RefloodOwnerIds = null;
|
||||
publication.RefloodCursor = 0;
|
||||
publication.RefloodCommitted = false;
|
||||
// Runtime coalesces post-seal arrivals in its owner journal.
|
||||
// Resume that seal tail rather than restarting the
|
||||
// completed generation-wide capture/reflood pass.
|
||||
publication.SealCommitted = false;
|
||||
_completePublishTicks += Stopwatch.GetTimestamp() - started;
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue