acdream/src/AcDream.App/Streaming
Erik bf31e59805 fix(streaming): close #54 — plumb JobKind through BuildLandblockForStreaming
Bug A's fix (commit `9217fd9`) patched at the worker output by stripping
entities from far-tier `LoadedLandblock`s after the full `LoadNear` path
ran. The worker still wasted CPU on `LandBlockInfo` reads + entity
hydration + `SceneryGenerator` math + interior-cell walks for ~544
far-tier LBs at radius=12, just to throw the work away.

This commit plumbs `LandblockStreamJobKind` through to the factory so the
worker can branch at the source:

- `LandblockStreamer.cs`: replace the `Func<uint, LoadedLandblock?>`
  factory with `Func<uint, LandblockStreamJobKind, LoadedLandblock?>` as
  the primary ctor signature. Add a back-compat overload that wraps the
  old single-arg signature (`(id, _) => loadLandblock(id)`) so existing
  test code keeps compiling without modification — the 5 ctor sites in
  `LandblockStreamerTests.cs` now resolve to the overload. `HandleJob`
  passes `load.Kind` to the factory; the post-load entity-strip is
  retained as a `Debug.Assert` + Release safety net.

- `GameWindow.cs`: `BuildLandblockForStreaming(uint, JobKind)` branches
  on `kind == LoadFar` at the top — reads only the `LandBlock` heightmap
  dat and returns a `LoadedLandblock` with `Array.Empty<WorldEntity>()`.
  Skips `LandblockLoader.Load` (which reads `LandBlockInfo`),
  `BuildSceneryEntitiesForStreaming`, and `BuildInteriorEntitiesForStreaming`
  entirely. Near-tier path is unchanged. Both call sites updated to pass
  the kind through the lambda: `(id, kind) => BuildLandblockForStreaming(id, kind)`.

Tests: 1688/1696 (8 pre-existing physics/input failures unchanged).
Streaming-targeted filter (30 tests covering LandblockStreamer +
StreamingController + StreamingRegion) all green via the back-compat
overload — no test code needed updating.

Per-LB worker cost on far-tier: was ~tens of ms (full hydration,
including LandBlockInfo + scenery generation + interior cells); now a
single `LandBlock` dat read (~sub-ms).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 16:03:16 +02:00
..
GpuWorldState.cs feat(A.5 T17): WbDrawDispatcher Change #1 — animated-walk fix + WalkEntities helper 2026-05-10 08:18:02 +02:00
LandblockStreamer.cs fix(streaming): close #54 — plumb JobKind through BuildLandblockForStreaming 2026-05-10 16:03:16 +02:00
LandblockStreamJob.cs feat(A.5 T7): LandblockStreamResult.Loaded.Tier+MeshData; Promoted variant 2026-05-09 22:53:07 +02:00
LandblockStreamTier.cs feat(A.5 T1): LandblockStreamTier + LandblockStreamJobKind enums 2026-05-09 22:15:57 +02:00
StreamingController.cs fix(A.5 T13-T16): canonicalize ids; init-only radii; demote/promote tests 2026-05-10 08:08:23 +02:00
StreamingRegion.cs fix(A.5 T4-T6): bootstrap guard + dead enum + test cleanups 2026-05-09 22:49:35 +02:00
TwoTierDiff.cs feat(A.5 T2): TwoTierDiff record + LandblockStreamJob.Load.Kind 2026-05-09 22:20:48 +02:00