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
|
// instead of allocating a fresh List<(WorldEntity, int)> per frame. At
|
||||||
// ~10K entities × ~3 mesh refs = ~30K tuples × 16 bytes = ~480 KB / frame
|
// ~10K entities × ~3 mesh refs = ~30K tuples × 16 bytes = ~480 KB / frame
|
||||||
// of GC pressure on the render thread under the original T17 shape.
|
// 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
|
// Per-entity-cull AABB radius. Conservative — covers most entities; large
|
||||||
// outliers (long banners, tall columns) are still landblock-culled.
|
// outliers (long banners, tall columns) are still landblock-culled.
|
||||||
|
|
@ -189,7 +189,7 @@ public sealed unsafe class WbDrawDispatcher : IDisposable
|
||||||
public struct WalkResult
|
public struct WalkResult
|
||||||
{
|
{
|
||||||
public int EntitiesWalked;
|
public int EntitiesWalked;
|
||||||
public List<(WorldEntity Entity, int MeshRefIndex)> ToDraw;
|
public List<(WorldEntity Entity, int MeshRefIndex, uint LandblockId)> ToDraw;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -224,7 +224,7 @@ public sealed unsafe class WbDrawDispatcher : IDisposable
|
||||||
HashSet<uint>? visibleCellIds,
|
HashSet<uint>? visibleCellIds,
|
||||||
HashSet<uint>? animatedEntityIds)
|
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 };
|
var result = new WalkResult { ToDraw = scratch };
|
||||||
WalkEntitiesInto(
|
WalkEntitiesInto(
|
||||||
landblockEntries, frustum, neverCullLandblockId,
|
landblockEntries, frustum, neverCullLandblockId,
|
||||||
|
|
@ -244,7 +244,7 @@ public sealed unsafe class WbDrawDispatcher : IDisposable
|
||||||
uint? neverCullLandblockId,
|
uint? neverCullLandblockId,
|
||||||
HashSet<uint>? visibleCellIds,
|
HashSet<uint>? visibleCellIds,
|
||||||
HashSet<uint>? animatedEntityIds,
|
HashSet<uint>? animatedEntityIds,
|
||||||
List<(WorldEntity Entity, int MeshRefIndex)> scratch,
|
List<(WorldEntity Entity, int MeshRefIndex, uint LandblockId)> scratch,
|
||||||
ref WalkResult result)
|
ref WalkResult result)
|
||||||
{
|
{
|
||||||
scratch.Clear();
|
scratch.Clear();
|
||||||
|
|
@ -271,7 +271,7 @@ public sealed unsafe class WbDrawDispatcher : IDisposable
|
||||||
&& !visibleCellIds.Contains(entity.ParentCellId.Value)) continue;
|
&& !visibleCellIds.Contains(entity.ParentCellId.Value)) continue;
|
||||||
result.EntitiesWalked++;
|
result.EntitiesWalked++;
|
||||||
for (int i = 0; i < entity.MeshRefs.Count; i++)
|
for (int i = 0; i < entity.MeshRefs.Count; i++)
|
||||||
scratch.Add((entity, i));
|
scratch.Add((entity, i, entry.LandblockId));
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -297,7 +297,7 @@ public sealed unsafe class WbDrawDispatcher : IDisposable
|
||||||
|
|
||||||
result.EntitiesWalked++;
|
result.EntitiesWalked++;
|
||||||
for (int i = 0; i < entity.MeshRefs.Count; i++)
|
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,
|
_walkScratch,
|
||||||
ref walkResult);
|
ref walkResult);
|
||||||
|
|
||||||
foreach (var (entity, partIdx) in _walkScratch)
|
foreach (var (entity, partIdx, landblockId) in _walkScratch)
|
||||||
{
|
{
|
||||||
if (diag) _entitiesSeen++;
|
if (diag) _entitiesSeen++;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue