diag(render): §4 flap [clip-route] probe — slot routing + clip-buffer content + landscape scissor

The decisive probe between the two surviving suspects from the 2026-06-09
building-flood-merge handoff (docs/research/2026-06-09-flap-outdoor-fullworld-
building-flood-merge-handoff.md section 1), gated by ACDREAM_PROBE_CLIPROUTE=1,
all print-on-change:

- [clip-route] (RetailPViewRenderer.DrawLandscapeThroughOutsideView): the
  outside slice slot + NDC AABB + planes, the CellIdToSlot routing table, the
  region-SSBO bytes DECODED at the routed slot, and the terrain-UBO head —
  captured after SetTerrainClip + UploadClipFrame + SetClipRouting, i.e.
  exactly what the landscape draws consume. Pins/refutes suspect (b) and the
  slot-repack half of suspect (a).
- [clip-route-disp] (WbDrawDispatcher.Draw, routed draws only): per-slot
  instance histogram exactly as staged for binding=3 plus the count of
  entities dropped by ResolveSlotForFrame CULL. Pins/refutes the
  instance-routing half of suspect (a).
- [clip-route-scis] (GameWindow.DrawRetailPViewLandscapeSlice): the ACTUAL GL
  scissor enable + box read back right after BeginDoorwayScissor — the whole
  landscape pass (sky + terrain + outdoor entities + player) draws inside this
  box, so a doorway-sized box here IS the full-world kill by construction.

Code-reading findings recorded while building the probe: the landscape pass is
scissored to slice.NdcAabb end-to-end (GameWindow.cs DrawRetailPViewLandscapeSlice),
and ResolveEntitySlot CULLs server entities with null ParentCellId while routing
is active — both now directly observable under the probe.

Throwaway apparatus — strip once §4 ships.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-06-10 08:37:09 +02:00
parent d877e4329a
commit 682cba36f1
4 changed files with 194 additions and 0 deletions

View file

@ -9415,6 +9415,8 @@ public sealed class GameWindow : IDisposable
{
var slice = sliceCtx.Slice;
bool scissor = BeginDoorwayScissor(true, slice.NdcAabb);
if (AcDream.Core.Rendering.RenderingDiagnostics.ProbeClipRouteEnabled)
EmitClipRouteScissorProbe(scissor, slice.NdcAabb);
_gl!.BindBufferBase(BufferTargetARB.UniformBuffer,
ClipFrame.TerrainClipUboBinding, _clipFrame!.TerrainUbo);
@ -9600,6 +9602,30 @@ public sealed class GameWindow : IDisposable
_glStateStable = 0;
}
// §4 flap [clip-route-scis] probe (2026-06-10, throwaway): the ACTUAL GL scissor state
// the landscape pass (sky + terrain + outdoor entities + the player) draws under, read
// back right after BeginDoorwayScissor. The whole pass is scissored to slice.NdcAabb —
// if the box reads doorway-sized here, the full-world flap is the scissor by
// construction, no RenderDoc needed. Print-on-change.
private string? _lastClipRouteScisSig;
private long _clipRouteScisSeq;
private void EmitClipRouteScissorProbe(bool applied, System.Numerics.Vector4 ndcAabb)
{
var gl = _gl;
if (gl is null) return;
Span<int> sbox = stackalloc int[4];
gl.GetInteger(GetPName.ScissorBox, sbox);
bool enabled = gl.IsEnabled(EnableCap.ScissorTest);
string sig = System.FormattableString.Invariant(
$"applied={(applied ? 1 : 0)} scis={(enabled ? 1 : 0)} box=({sbox[0]},{sbox[1]},{sbox[2]},{sbox[3]}) ndc=({ndcAabb.X:F3},{ndcAabb.Y:F3},{ndcAabb.Z:F3},{ndcAabb.W:F3})");
_clipRouteScisSeq++;
if (sig == _lastClipRouteScisSig)
return;
_lastClipRouteScisSig = sig;
Console.WriteLine($"[clip-route-scis] n={_clipRouteScisSeq} {sig}");
}
private void EnableClipDistances()
{
for (int i = 0; i < ClipFrame.MaxPlanes; i++)