perf(streaming): scope reveal warmup spatially

Source composite warmup from the canonical published destination neighborhood, including quiesced static and live projections, instead of rescanning the retained Far-tier world after every membership edge.

This lifecycle correction applies to both draw paths, preserving ef1d263337 as the sole G4 visual rollback.

Co-authored-by: OpenAI Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-25 04:39:48 +02:00
parent 129dd77ddd
commit 03b10183e9
5 changed files with 212 additions and 6 deletions

View file

@ -449,6 +449,46 @@ public sealed class GpuWorldState : ILiveEntitySpatialQuery
}
}
/// <summary>
/// Copies every published projection from a bounded destination
/// neighborhood for presentation-readiness work. Unlike gameplay-facing
/// spatial queries, this remains available while the world generation is
/// quiesced: the reveal barrier must prepare destination resources before
/// it makes that generation observable.
/// </summary>
internal void CopyPublishedEntitiesNearLandblockForReadiness(
uint centerCellOrLandblockId,
int landblockRadius,
List<WorldEntity> destination)
{
ArgumentNullException.ThrowIfNull(destination);
ArgumentOutOfRangeException.ThrowIfNegative(landblockRadius);
destination.Clear();
int centerX = (int)((centerCellOrLandblockId >> 24) & 0xFFu);
int centerY = (int)((centerCellOrLandblockId >> 16) & 0xFFu);
for (int dx = -landblockRadius; dx <= landblockRadius; dx++)
for (int dy = -landblockRadius; dy <= landblockRadius; dy++)
{
int x = centerX + dx;
int y = centerY + dy;
if ((uint)x > 0xFFu || (uint)y > 0xFFu)
continue;
uint landblockId =
((uint)x << 24) | ((uint)y << 16) | 0xFFFFu;
if (!_loaded.TryGetValue(
landblockId,
out LoadedLandblock? landblock))
{
continue;
}
for (int i = 0; i < landblock.Entities.Count; i++)
destination.Add(landblock.Entities[i]);
}
}
public readonly ref struct MutationBatch
{
private readonly GpuWorldState _owner;