feat(A.5 T13): StreamingController two-tier Tick
Replaces the single-radius Tick with a two-tier model that consumes StreamingRegion's TwoTierDiff (5-list) and routes to the appropriate JobKind: - ToLoadFar -> _enqueueLoad(id, LoadFar) - ToLoadNear -> _enqueueLoad(id, LoadNear) - ToPromote -> _enqueueLoad(id, PromoteToNear) - ToDemote -> _state.RemoveEntitiesFromLandblock(id) on render thread - ToUnload -> _enqueueUnload(id) Drain switch handles Loaded (terrain + entity layer), Promoted (entity layer only -- terrain already loaded), Unloaded, Failed, WorkerCrashed. Constructor signature: nearRadius/farRadius separate ints. Old single- radius ctor removed; existing single-radius tests updated to pass nearRadius=farRadius for backward-compat coverage. GameWindow's enqueueLoad lambda updated from (id =>...) to (id, kind) => to match new Action<uint, LandblockStreamJobKind> signature; radius: arg renamed to nearRadius:/farRadius: (both set to _streamingRadius until T16 wires the full two-tier env-var parsing). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
aff35d2a76
commit
b8d80fe282
4 changed files with 79 additions and 29 deletions
|
|
@ -0,0 +1,38 @@
|
|||
using System.Collections.Generic;
|
||||
using AcDream.App.Streaming;
|
||||
using AcDream.Core.Terrain;
|
||||
using AcDream.Core.World;
|
||||
using Xunit;
|
||||
|
||||
namespace AcDream.Core.Tests.Streaming;
|
||||
|
||||
public class StreamingControllerTwoTierTests
|
||||
{
|
||||
[Fact]
|
||||
public void Tick_FirstCall_EnqueuesNearAndFarLoadsByTier()
|
||||
{
|
||||
var loads = new List<(uint Id, LandblockStreamJobKind Kind)>();
|
||||
var unloads = new List<uint>();
|
||||
var state = new GpuWorldState();
|
||||
|
||||
var ctrl = new StreamingController(
|
||||
enqueueLoad: (id, kind) => loads.Add((id, kind)),
|
||||
enqueueUnload: unloads.Add,
|
||||
drainCompletions: _ => System.Array.Empty<LandblockStreamResult>(),
|
||||
applyTerrain: (_, _) => { },
|
||||
state: state,
|
||||
nearRadius: 1,
|
||||
farRadius: 3);
|
||||
|
||||
ctrl.Tick(observerCx: 100, observerCy: 100);
|
||||
|
||||
int nearCount = 0, farCount = 0;
|
||||
foreach (var (_, kind) in loads)
|
||||
{
|
||||
if (kind == LandblockStreamJobKind.LoadNear) nearCount++;
|
||||
else if (kind == LandblockStreamJobKind.LoadFar) farCount++;
|
||||
}
|
||||
Assert.Equal(9, nearCount); // 3x3 inner ring (radius=1)
|
||||
Assert.Equal(40, farCount); // 7x7 - 3x3 outer ring (radius=3)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue