refactor(render #53): plumb landblockId through WbDrawDispatcher walkScratch
Extends the walk scratch tuple from (entity, meshRefIndex) to (entity, meshRefIndex, landblockId). The dispatcher's per-entity loop now has the landblock id available for EntityClassificationCache.Populate's landblockHint argument (consumed in Task 9). No behavior change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a171e7007b
commit
60fbfce8bc
1 changed files with 7 additions and 7 deletions
|
|
@ -113,7 +113,7 @@ public sealed unsafe class WbDrawDispatcher : IDisposable
|
|||
// instead of allocating a fresh List<(WorldEntity, int)> per frame. At
|
||||
// ~10K entities × ~3 mesh refs = ~30K tuples × 16 bytes = ~480 KB / frame
|
||||
// of GC pressure on the render thread under the original T17 shape.
|
||||
private readonly List<(WorldEntity Entity, int MeshRefIndex)> _walkScratch = new();
|
||||
private readonly List<(WorldEntity Entity, int MeshRefIndex, uint LandblockId)> _walkScratch = new();
|
||||
|
||||
// Per-entity-cull AABB radius. Conservative — covers most entities; large
|
||||
// outliers (long banners, tall columns) are still landblock-culled.
|
||||
|
|
@ -189,7 +189,7 @@ public sealed unsafe class WbDrawDispatcher : IDisposable
|
|||
public struct WalkResult
|
||||
{
|
||||
public int EntitiesWalked;
|
||||
public List<(WorldEntity Entity, int MeshRefIndex)> ToDraw;
|
||||
public List<(WorldEntity Entity, int MeshRefIndex, uint LandblockId)> ToDraw;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -224,7 +224,7 @@ public sealed unsafe class WbDrawDispatcher : IDisposable
|
|||
HashSet<uint>? visibleCellIds,
|
||||
HashSet<uint>? animatedEntityIds)
|
||||
{
|
||||
var scratch = new List<(WorldEntity Entity, int MeshRefIndex)>();
|
||||
var scratch = new List<(WorldEntity Entity, int MeshRefIndex, uint LandblockId)>();
|
||||
var result = new WalkResult { ToDraw = scratch };
|
||||
WalkEntitiesInto(
|
||||
landblockEntries, frustum, neverCullLandblockId,
|
||||
|
|
@ -244,7 +244,7 @@ public sealed unsafe class WbDrawDispatcher : IDisposable
|
|||
uint? neverCullLandblockId,
|
||||
HashSet<uint>? visibleCellIds,
|
||||
HashSet<uint>? animatedEntityIds,
|
||||
List<(WorldEntity Entity, int MeshRefIndex)> scratch,
|
||||
List<(WorldEntity Entity, int MeshRefIndex, uint LandblockId)> scratch,
|
||||
ref WalkResult result)
|
||||
{
|
||||
scratch.Clear();
|
||||
|
|
@ -271,7 +271,7 @@ public sealed unsafe class WbDrawDispatcher : IDisposable
|
|||
&& !visibleCellIds.Contains(entity.ParentCellId.Value)) continue;
|
||||
result.EntitiesWalked++;
|
||||
for (int i = 0; i < entity.MeshRefs.Count; i++)
|
||||
scratch.Add((entity, i));
|
||||
scratch.Add((entity, i, entry.LandblockId));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
|
@ -297,7 +297,7 @@ public sealed unsafe class WbDrawDispatcher : IDisposable
|
|||
|
||||
result.EntitiesWalked++;
|
||||
for (int i = 0; i < entity.MeshRefs.Count; i++)
|
||||
scratch.Add((entity, i));
|
||||
scratch.Add((entity, i, entry.LandblockId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -364,7 +364,7 @@ public sealed unsafe class WbDrawDispatcher : IDisposable
|
|||
_walkScratch,
|
||||
ref walkResult);
|
||||
|
||||
foreach (var (entity, partIdx) in _walkScratch)
|
||||
foreach (var (entity, partIdx, landblockId) in _walkScratch)
|
||||
{
|
||||
if (diag) _entitiesSeen++;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue