feat(render) Campaign FW3.2b-2: THE STATIC CUTOVER - the walk drives production statics

The retail frame walk now drives every production static draw. In
RetailPViewRenderer.DrawInside, when the concrete executor + the
packed product + the FW3.1 walk registries are all wired (all
production compositions - anything less throws):

- A pre-walk events-only collection pass (the shadow sink generalized
  to WalkVisitedSetCollector) gathers the frame's visited cells,
  buildings, and landscape-cell turns; the visited cells union into
  prepareCells so EnvCellRenderer prepares every shell the driver
  draws.
- DrawWalkDrivenStatics runs the WalkFrameDriver over the production
  world data (WalkProductionWorldData over RenderSceneQuery + the
  building registry): sky, terrain slices, outdoor statics at their
  landscape-cell turns, buildings (alpha barrier -> punch/look-in
  passes -> shell) in retail order, interior clear+seals as leaf
  closures (the old tail block's drain reasoning moves with them),
  flood cells shell-then-contents. Landscape/cell-stage particle
  owners re-source from the walk's visited sets - retail gates
  particles per cell turn (ShouldDrawParticles @0x0050FE60), which
  this is; the old sphere filter was the approximation.
- DrawLandscapeDynamicsPhase + DrawBuildingLookInDynamics carry the
  dynamics-only remainder (LookInObject now dynamic-classified,
  late outside-dynamics + weather, particle unions); DrawDynamicsLast
  and the outdoor flush are unchanged.
- The product builder stops emitting LandscapeOutdoorStatic /
  LandscapeBuildingShell / CellStatic (methods deleted, dead index
  tracking removed); LookInObject loads cells with
  includeStatics: false.

The old static path survives ONLY behind !walkActive for the
standalone/diagnostic executor-fake path that keeps 15 retail-ordering
regression tests exercising the barrier/punch/seal machinery; no
production composition can reach it. Its deletion is FW4 scope (the
plan's "deleting the patch apparatus") - recorded in the plan.

Transitional risks recorded in code/report: the two-pass walk cost
(FW3.4 measures), the interior slice-count reconciliation between the
old clip assembly and the walk's own exit-view survival, and the
outdoor merged-flood punch coverage now riding the walk's own
building-BSP punches (retail-faithful per FW1; the owner visual gate
verifies).

Suites (lead-verified): full Release build 0 warnings; hermetic
6,750/0 (baseline minus the three deleted route tests); Walk lane
201/1; InstalledDat Walk conformance 40/1 untouched. The two
IL-branch tests the implementation round reported failing pass in
every lead run - the recurring parallel-load flake pair.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-30 15:43:22 +02:00
parent 878533597d
commit 4918677b45
8 changed files with 919 additions and 612 deletions

View file

@ -14,326 +14,33 @@ public sealed class RenderScenePViewFrameProductTests
private static readonly RenderSceneGeneration Generation =
RenderSceneGeneration.FromRaw(1);
[Fact]
public void Builder_PreservesPViewRoutesAndExcludesShellsAndWithdrawnOwners()
{
using var scene = new ArchRenderScene(Generation);
RenderProjectionRecord outdoor = Record(
0x0100_0000_0000_0001,
RenderProjectionClass.OutdoorStatic);
RenderProjectionRecord buildingShell = Record(
0x0100_0000_0000_0008,
RenderProjectionClass.OutdoorStatic,
isBuildingShell: true);
RenderProjectionRecord hidden = Record(
0x0100_0000_0000_0002,
RenderProjectionClass.OutdoorStatic,
flags: RenderProjectionFlags.Hidden
| RenderProjectionFlags.SpatiallyResident);
RenderProjectionRecord withdrawn = Record(
0x0100_0000_0000_0003,
RenderProjectionClass.OutdoorStatic,
flags: RenderProjectionFlags.Draw);
RenderProjectionRecord shell = Record(
0x0200_0000_0000_0004,
RenderProjectionClass.IndoorCellStatic,
parentCell: Cell);
RenderProjectionRecord cellStatic = Record(
0x0100_0000_0000_0005,
RenderProjectionClass.IndoorCellStatic,
parentCell: Cell);
RenderProjectionRecord outdoorDynamic = Record(
0x0300_0000_0000_0006,
RenderProjectionClass.LiveDynamicRoot);
RenderProjectionRecord cellDynamic = Record(
0x0300_0000_0000_0007,
RenderProjectionClass.LiveDynamicRoot,
parentCell: Cell);
RenderProjectionRecord[] records =
[
outdoor,
buildingShell,
hidden,
withdrawn,
shell,
cellStatic,
outdoorDynamic,
cellDynamic,
];
var deltas = new RenderProjectionDelta[records.Length];
for (int index = 0; index < records.Length; index++)
{
deltas[index] = RenderProjectionDelta.Register(
Generation,
(ulong)index + 1,
records[index]);
}
scene.Apply(deltas);
PortalVisibilityFrame portal = Portal(Cell);
ClipFrameAssembly clip = FullScreenClip(Cell);
ViewconeCuller viewcone =
ViewconeCuller.Build(clip, Matrix4x4.Identity);
var exchange = new RenderFrameExchange();
var builder = new RenderScenePViewFrameBuilder();
RenderSceneDigest digest =
scene.BuildDigest(new RenderSceneDigestBuffer());
var input = new RenderScenePViewBuildInput(
scene.OpenQuery(),
digest,
portal,
clip,
viewcone,
[],
[Cell],
EmptyCellSource.Instance,
[],
RootIsOutdoor: true);
builder.Build(exchange, frameSequence: 1, in input);
RenderFrameView view = exchange.BorrowLatest(Generation, 1);
try
{
Assert.Equal(
[outdoor.Id, hidden.Id, buildingShell.Id],
view.OutdoorStaticCandidates.ToArray()
.Select(static item => item.Id));
Assert.Equal(
[cellStatic.Id],
view.CellStaticCandidates.ToArray()
.Select(static item => item.Id));
Assert.Equal(
[outdoorDynamic.Id, cellDynamic.Id],
view.DynamicCandidates.ToArray()
.Select(static item => item.Id));
Assert.Equal(6, view.Transforms.Length);
Assert.Equal(6, view.RouteCandidates.Length);
Assert.Equal(3, view.RouteRanges.Length);
RenderFrameCandidateRange outdoorRange = Assert.Single(
view.RouteRanges.ToArray(),
range => range.Route
== RenderFrameCandidateRoute.LandscapeOutdoorStatic);
Assert.Equal(3, outdoorRange.Count);
Assert.Contains(
view.RouteCandidates.Slice(
outdoorRange.Offset,
outdoorRange.Count).ToArray(),
item => item.Id == buildingShell.Id);
Assert.DoesNotContain(
view.RouteRanges.ToArray(),
range => range.Route
== RenderFrameCandidateRoute.LandscapeBuildingShell);
Assert.DoesNotContain(
view.RouteCandidates.ToArray(),
item => item.Id == withdrawn.Id || item.Id == shell.Id);
Assert.Equal(
new RenderFrameDiagnosticCounts(
OutdoorStaticCandidates: 3,
CellStaticCandidates: 1,
DynamicCandidates: 2,
TransformCount: 6,
OpaqueClassificationCount: 0,
AlphaClassificationCount: 0,
LightSetCount: 0,
SelectionPartCount: 0,
RouteCandidateCount: 6,
EntityCandidateCount: 6,
MeshPartCount: 6),
view.DiagnosticCounts);
Assert.Equal(6, view.EntityCandidates.Length);
Assert.Equal(6, view.MeshParts.Length);
Assert.Same(portal, view.PortalFrame);
Assert.Same(clip, view.ClipAssembly);
Assert.Equal(digest, view.SourceDigest);
}
finally
{
exchange.Release(in view);
}
}
[Fact]
public void Builder_OrdersMultiSliceBuildingShellsAfterLookIns()
{
using var scene = new ArchRenderScene(Generation);
RenderProjectionRecord outdoor = Record(
0x0100_0000_0000_0101,
RenderProjectionClass.OutdoorStatic);
RenderProjectionRecord buildingShell = Record(
0x0100_0000_0000_0102,
RenderProjectionClass.OutdoorStatic,
isBuildingShell: true,
buildingShellAnchorCellId: Cell);
RenderProjectionRecord lookInObject = Record(
0x0100_0000_0000_0103,
RenderProjectionClass.IndoorCellStatic,
parentCell: Cell);
scene.Apply(
[
RenderProjectionDelta.Register(Generation, 1, outdoor),
RenderProjectionDelta.Register(Generation, 2, buildingShell),
RenderProjectionDelta.Register(Generation, 3, lookInObject),
]);
PortalVisibilityFrame portal = Portal(Cell);
PortalVisibilityFrame lookIn = Portal(Cell);
lookIn.SourceBuildingKey = 2u;
lookIn.SourceBuildingLandblockId = Cell & 0xFFFF0000u;
var anchorCell = new LoadedCell
{
CellId = Cell,
BuildingId = 2u,
};
ClipFrameAssembly clip = TwoSliceClip(Cell);
clip.LookInCellToViewSlices[new LookInClipCell(0, Cell)] =
[clip.CellIdToViewSlices[Cell][0]];
ViewconeCuller viewcone =
ViewconeCuller.Build(clip, Matrix4x4.Identity);
var exchange = new RenderFrameExchange();
var builder = new RenderScenePViewFrameBuilder();
RenderSceneDigest digest =
scene.BuildDigest(new RenderSceneDigestBuffer());
var input = new RenderScenePViewBuildInput(
scene.OpenQuery(),
digest,
portal,
clip,
viewcone,
[lookIn],
[Cell],
new DictionaryCellSource(anchorCell),
[],
RootIsOutdoor: true);
builder.Build(exchange, frameSequence: 1, in input);
RenderFrameView view = exchange.BorrowLatest(Generation, 1);
try
{
Assert.Equal(
[
(RenderFrameCandidateRoute.LandscapeOutdoorStatic, 0, 0u),
(RenderFrameCandidateRoute.LandscapeOutdoorStatic, 1, 0u),
(RenderFrameCandidateRoute.LookInObject, 0, Cell),
(RenderFrameCandidateRoute.LandscapeBuildingShell, 0, 0u),
(RenderFrameCandidateRoute.LandscapeBuildingShell, 1, 0u),
(RenderFrameCandidateRoute.CellStatic, 0, 0u),
],
view.RouteRanges.ToArray().Select(static range =>
(range.Route, range.RouteIndex, range.CellId)));
}
finally
{
exchange.Release(in view);
}
}
[Fact]
public void Builder_InterleavesEachLookInWithItsOwnPackedBuildingShellRoutes()
{
const uint secondCell = 0xA9B40180u;
using var scene = new ArchRenderScene(Generation);
RenderProjectionRecord firstShell = Record(
0x0100_0000_0000_0201,
RenderProjectionClass.OutdoorStatic,
isBuildingShell: true,
buildingShellAnchorCellId: Cell);
RenderProjectionRecord secondShell = Record(
0x0100_0000_0000_0202,
RenderProjectionClass.OutdoorStatic,
isBuildingShell: true,
buildingShellAnchorCellId: secondCell);
RenderProjectionRecord firstObject = Record(
0x0100_0000_0000_0203,
RenderProjectionClass.IndoorCellStatic,
parentCell: Cell);
RenderProjectionRecord secondObject = Record(
0x0100_0000_0000_0204,
RenderProjectionClass.IndoorCellStatic,
parentCell: secondCell);
scene.Apply(
[
RenderProjectionDelta.Register(Generation, 1, firstShell),
RenderProjectionDelta.Register(Generation, 2, secondShell),
RenderProjectionDelta.Register(Generation, 3, firstObject),
RenderProjectionDelta.Register(Generation, 4, secondObject),
]);
PortalVisibilityFrame portal = Portal(Cell);
PortalVisibilityFrame firstLookIn = Portal(Cell);
firstLookIn.SourceBuildingKey = 2u;
firstLookIn.SourceBuildingLandblockId = Cell & 0xFFFF0000u;
PortalVisibilityFrame secondLookIn = Portal(secondCell);
secondLookIn.SourceBuildingKey = 3u;
secondLookIn.SourceBuildingLandblockId = secondCell & 0xFFFF0000u;
var firstAnchor = new LoadedCell
{
CellId = Cell,
BuildingId = 2u,
};
var secondAnchor = new LoadedCell
{
CellId = secondCell,
BuildingId = 3u,
};
ClipFrameAssembly clip = TwoSliceClip(Cell);
clip.LookInCellToViewSlices[new LookInClipCell(0, Cell)] =
[clip.CellIdToViewSlices[Cell][0]];
clip.LookInCellToViewSlices[new LookInClipCell(1, secondCell)] =
[clip.CellIdToViewSlices[Cell][0]];
ViewconeCuller viewcone =
ViewconeCuller.Build(clip, Matrix4x4.Identity);
var exchange = new RenderFrameExchange();
var builder = new RenderScenePViewFrameBuilder();
RenderSceneDigest digest =
scene.BuildDigest(new RenderSceneDigestBuffer());
var input = new RenderScenePViewBuildInput(
scene.OpenQuery(),
digest,
portal,
clip,
viewcone,
[firstLookIn, secondLookIn],
[Cell],
new DictionaryCellSource(firstAnchor, secondAnchor),
[],
RootIsOutdoor: true);
builder.Build(exchange, frameSequence: 1, in input);
RenderFrameView view = exchange.BorrowLatest(Generation, 1);
try
{
Assert.Equal(
[
(RenderFrameCandidateRoute.LookInObject, 0, Cell),
(RenderFrameCandidateRoute.LandscapeBuildingShell, 0, 0u),
(RenderFrameCandidateRoute.LandscapeBuildingShell, 1, 0u),
(RenderFrameCandidateRoute.LookInObject, 1, secondCell),
(RenderFrameCandidateRoute.LandscapeBuildingShell, 2, 0u),
(RenderFrameCandidateRoute.LandscapeBuildingShell, 3, 0u),
],
view.RouteRanges.ToArray()
.Where(static range =>
range.Route is RenderFrameCandidateRoute.LookInObject
or RenderFrameCandidateRoute.LandscapeBuildingShell)
.Select(static range =>
(range.Route, range.RouteIndex, range.CellId)));
}
finally
{
exchange.Release(in view);
}
}
// Campaign FW3.2b-2 (adjudicated 2026-08-30): Builder_PreservesPViewRoutesAndExcludesShellsAndWithdrawnOwners,
// Builder_OrdersMultiSliceBuildingShellsAfterLookIns, and
// Builder_InterleavesEachLookInWithItsOwnPackedBuildingShellRoutes are
// DELETED — all three asserted route-range interleaving for
// LandscapeOutdoorStatic/LandscapeBuildingShell/CellStatic, which
// RenderScenePViewFrameBuilder no longer emits at all (WalkFrameDriver
// draws every outdoor static, building shell, and cell static — look-in
// included — directly through OrderedDrawStream; plan §FW3
// "FW3.2b-2 — the production rooting", item 3). There is no successor
// assertion to write: the routes themselves are retired, not relocated.
[Fact]
public void Builder_ReusesOrderedIndicesWhileRefreshingDirtyRecords()
{
// Campaign FW3.2b-2 (adjudicated 2026-08-30): re-expressed against
// the DYNAMIC index (LiveDynamicRoot / DynamicCandidates) instead of
// the now-dead OutdoorStatic index — LoadSceneIndices' dirty-record
// refresh + sort-key reorder mechanism this test proves is SHARED
// between the two indices; the OutdoorStatic side was deleted along
// with BuildOutdoorRoutes (its only reader).
using var scene = new ArchRenderScene(Generation);
RenderProjectionRecord later = Record(
0x0100_0000_0000_0012,
RenderProjectionClass.OutdoorStatic);
RenderProjectionClass.LiveDynamicRoot);
RenderProjectionRecord earlier = Record(
0x0100_0000_0000_0011,
RenderProjectionClass.OutdoorStatic);
RenderProjectionClass.LiveDynamicRoot);
scene.Apply(
[
RenderProjectionDelta.Register(Generation, 1, later),
@ -353,7 +60,7 @@ public sealed class RenderScenePViewFrameProductTests
{
Assert.Equal(
[earlier.Id, later.Id],
first.OutdoorStaticCandidates.ToArray()
first.DynamicCandidates.ToArray()
.Select(static record => record.Id));
}
finally
@ -401,7 +108,7 @@ public sealed class RenderScenePViewFrameProductTests
projected.Transform.LocalToWorld);
Assert.Equal(
[earlier.Id, later.Id],
second.OutdoorStaticCandidates.ToArray()
second.DynamicCandidates.ToArray()
.Select(static record => record.Id));
}
finally
@ -431,7 +138,7 @@ public sealed class RenderScenePViewFrameProductTests
{
Assert.Equal(
[later.Id, earlier.Id],
third.OutdoorStaticCandidates.ToArray()
third.DynamicCandidates.ToArray()
.Select(static record => record.Id));
}
finally
@ -463,14 +170,18 @@ public sealed class RenderScenePViewFrameProductTests
[Fact]
public void Controller_MatchesCurrentPViewThenNamesAWithdrawnCandidate()
{
WorldEntity outdoor = Entity(10, serverGuid: 0, parentCell: null);
WorldEntity cellStatic = Entity(11, serverGuid: 0, parentCell: Cell);
// Campaign FW3.2b-2 (adjudicated 2026-08-30): no static entities here
// — LandscapeOutdoorStatic/CellStatic no longer flow through the
// packed product at all (WalkFrameDriver owns every static now), so
// a static observed on the LEGACY oracle side with nothing on the
// packed side would report a permanent mismatch unrelated to what
// this test is proving (withdrawal detection on the SURVIVING
// DynamicLast route).
WorldEntity outdoorDynamic =
Entity(1_000_012, 0x8000_0012, parentCell: null);
WorldEntity cellDynamic =
Entity(1_000_013, 0x8000_0013, parentCell: Cell);
WorldEntity[] entities =
[outdoor, cellStatic, outdoorDynamic, cellDynamic];
WorldEntity[] entities = [outdoorDynamic, cellDynamic];
var oracle = new CurrentRenderSceneOracle();
var partition = new InteriorEntityPartition.Result();
InteriorEntityPartition.Partition(
@ -479,16 +190,6 @@ public sealed class RenderScenePViewFrameProductTests
[Entry(entities)],
oracle);
oracle.BeginPViewFrame();
oracle.ObservePViewBucket(
CurrentRenderPViewRoute.LandscapeOutdoorStatic,
0,
0,
[outdoor]);
oracle.ObservePViewBucket(
CurrentRenderPViewRoute.CellStatic,
0,
0,
[cellStatic]);
oracle.ObservePViewBucket(
CurrentRenderPViewRoute.DynamicLast,
0,
@ -496,14 +197,6 @@ public sealed class RenderScenePViewFrameProductTests
[outdoorDynamic, cellDynamic]);
oracle.CompletePViewFrame();
oracle.BeginDispatcherFrame();
oracle.ObserveDispatcherDraw(
WbDrawDispatcher.EntitySet.All,
entitiesWalked: 1,
[(outdoor, 0, Landblock)]);
oracle.ObserveDispatcherDraw(
WbDrawDispatcher.EntitySet.All,
entitiesWalked: 1,
[(cellStatic, 0, Landblock)]);
oracle.ObserveDispatcherDraw(
WbDrawDispatcher.EntitySet.All,
entitiesWalked: 2,
@ -544,15 +237,15 @@ public sealed class RenderScenePViewFrameProductTests
Assert.True(matched.Enabled);
Assert.Equal(1uL, matched.ComparisonCount);
Assert.Equal(1uL, matched.SuccessfulComparisonCount);
Assert.Equal(4, matched.ExpectedCandidateCount);
Assert.Equal(4, matched.ActualCandidateCount);
Assert.Equal(2, matched.ExpectedCandidateCount);
Assert.Equal(2, matched.ActualCandidateCount);
Assert.Equal(0, matched.MismatchCount);
Assert.Null(matched.FirstMismatch);
Assert.Equal(matched.ExpectedDigest, matched.ActualDigest);
Assert.Equal(1uL, matched.PackedInputComparisonCount);
Assert.Equal(1uL, matched.PackedInputSuccessfulComparisonCount);
Assert.Equal(4, matched.PackedInputExpectedCount);
Assert.Equal(4, matched.PackedInputActualCount);
Assert.Equal(2, matched.PackedInputExpectedCount);
Assert.Equal(2, matched.PackedInputActualCount);
Assert.Equal(0, matched.PackedInputMismatchCount);
Assert.Null(matched.PackedInputFirstMismatch);
Assert.Equal(
@ -581,10 +274,10 @@ public sealed class RenderScenePViewFrameProductTests
Assert.Equal(2uL, mismatch.ComparisonCount);
Assert.Equal(1uL, mismatch.SuccessfulComparisonCount);
Assert.Equal(1, mismatch.MismatchCount);
Assert.Contains("field=count expected=4 actual=3", mismatch.FirstMismatch);
Assert.Contains("field=count expected=2 actual=1", mismatch.FirstMismatch);
Assert.Equal(1, mismatch.PackedInputMismatchCount);
Assert.Contains(
"field=count expected=4 actual=3",
"field=count expected=2 actual=1",
mismatch.PackedInputFirstMismatch);
Assert.Equal(2, logs.Count);
}

View file

@ -196,10 +196,15 @@ public sealed class RetailPViewPassExecutorTests
[Fact]
public void DrawInside_production_product_supplies_the_ordered_entity_routes()
{
// Campaign FW3.2b-2: no cell-static entity here (adjudicated
// 2026-08-30) — CellStatic no longer flows through the packed
// product at all (WalkFrameDriver owns every cell static now, via
// OrderedDrawStream, not this route); a static entity registered on
// the LEGACY side with nothing on the packed side would report a
// permanent MismatchCount, which is not what this test is proving.
// The route-consumption-order assertion below still exercises the
// one route that DID survive the cutover (DynamicLast).
LoadedCell interior = InteriorWithExit(0xA9B40100u);
WorldEntity cellStatic = Entity(
30u,
parentCellId: interior.CellId);
WorldEntity dynamic = Entity(
31u,
serverGuid: 0x80000031u,
@ -208,17 +213,6 @@ public sealed class RetailPViewPassExecutorTests
var oracle = new CurrentRenderSceneOracle();
using var shadow = new RenderSceneShadowRuntime(
RenderSceneGeneration.FromRaw(1));
RenderProjectionRecord staticRecord =
RenderProjectionRecordFactory.ProjectEntity(
StaticRenderProjectionJournal.StaticEntityId(
landblockId,
cellStatic.Id),
RenderProjectionClass.IndoorCellStatic,
RenderOwnerIncarnation.FromRaw(cellStatic.Id),
landblockId,
interior.CellId,
cellStatic,
spatiallyVisible: true);
RenderProjectionRecord dynamicRecord =
RenderProjectionRecordFactory.ProjectEntity(
LiveRenderProjectionJournal.ProjectionId(dynamic.Id),
@ -228,7 +222,6 @@ public sealed class RetailPViewPassExecutorTests
interior.CellId,
dynamic,
spatiallyVisible: true);
shadow.Journal.Register(in staticRecord);
shadow.Journal.Register(in dynamicRecord);
shadow.DrainUpdateBoundary();
var product = new RenderScenePViewFrameProductController(
@ -238,13 +231,12 @@ public sealed class RetailPViewPassExecutorTests
using var executor = new RecordingExecutor();
renderer.DrawInside(
Frame(interior, [cellStatic, dynamic]),
Frame(interior, [dynamic]),
executor);
AssertAppearsInOrder(
string.Join('|', executor.Operations),
"entity-frame-begin",
"entity-route:CellStatic:0:00000000",
"entity-route:DynamicLast:0:00000000",
"entity-frame-complete");
Assert.Equal(0, product.Snapshot.MismatchCount);