perf(rendering): reconcile only changed attachments
This commit is contained in:
parent
6b56f4bef2
commit
b9cbf5e040
8 changed files with 246 additions and 14 deletions
|
|
@ -28,6 +28,7 @@ public sealed class EntityEffectPoseRegistry :
|
|||
public bool[] PartAvailable = Array.Empty<bool>();
|
||||
public uint CellId;
|
||||
public ulong LifetimeVersion;
|
||||
public ulong ChangeVersion;
|
||||
}
|
||||
|
||||
private readonly Dictionary<uint, PoseRecord> _poses = new();
|
||||
|
|
@ -112,7 +113,10 @@ public sealed class EntityEffectPoseRegistry :
|
|||
}
|
||||
|
||||
if (changed)
|
||||
{
|
||||
record.ChangeVersion++;
|
||||
EffectPoseChanged?.Invoke(entity.Id);
|
||||
}
|
||||
}
|
||||
|
||||
public void Publish(
|
||||
|
|
@ -142,7 +146,10 @@ public sealed class EntityEffectPoseRegistry :
|
|||
record.CellId = cellId;
|
||||
changed |= CopyParts(record, partLocal, availability);
|
||||
if (changed)
|
||||
{
|
||||
record.ChangeVersion++;
|
||||
EffectPoseChanged?.Invoke(localEntityId);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Refresh only the moving root while retaining current part poses.</summary>
|
||||
|
|
@ -159,6 +166,7 @@ public sealed class EntityEffectPoseRegistry :
|
|||
|
||||
record.RootWorld = rootWorld;
|
||||
record.CellId = cellId;
|
||||
record.ChangeVersion++;
|
||||
EffectPoseChanged?.Invoke(entity.Id);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -258,6 +266,16 @@ public sealed class EntityEffectPoseRegistry :
|
|||
? record.LifetimeVersion
|
||||
: 0UL;
|
||||
|
||||
/// <summary>
|
||||
/// Monotonic version of the current lifetime's root, part, availability,
|
||||
/// or cell pose. Synchronous presentation owners use it to avoid repeating
|
||||
/// a derived composition when the published parent pose is unchanged.
|
||||
/// </summary>
|
||||
public ulong GetPoseChangeVersion(uint localEntityId) =>
|
||||
_poses.TryGetValue(localEntityId, out PoseRecord? record)
|
||||
? record.ChangeVersion
|
||||
: 0UL;
|
||||
|
||||
private ulong NextLifetimeVersion()
|
||||
{
|
||||
_nextLifetimeVersion++;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue