perf(physics): cut production traversal to flat assets

Make prepared flat BSP data authoritative for gameplay while retaining the parsed graph only as an exact sampled referee. Fail production publication when collision package data is genuinely absent, keep idempotent already-cached publication valid, and move cell membership, floor lookup, camera diagnostics, and live/static shape bounds onto the flat representation.

Validated by 8,402 Release tests, a strict dense-Arwic connected gate with 46,309/46,309 exact referee matches, and graceful shutdown.

Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-25 17:00:04 +02:00
parent d9446030e6
commit 068a06518d
13 changed files with 743 additions and 43 deletions

View file

@ -13,9 +13,9 @@ public readonly record struct CollisionShadowStats(
long Faults);
/// <summary>
/// Slice I5 sampled graph/flat referee. The graph result always remains
/// authoritative. One retained clone receives the flat query first; the
/// canonical transition is then evaluated by the graph path and compared
/// Slice I5/I6 sampled graph/flat referee. The authority is selected by
/// <see cref="PhysicsDataCache.CollisionTraversalMode"/>. One retained clone
/// receives the non-authoritative query and the two results are compared
/// field-for-field with exact float bits.
/// </summary>
internal sealed class CollisionShadowVerifier
@ -29,6 +29,7 @@ internal sealed class CollisionShadowVerifier
private long _mismatches;
private long _faults;
private bool _flatPass;
private bool _graphPass;
public CollisionShadowVerifier(
int sampleEvery,
@ -42,6 +43,7 @@ internal sealed class CollisionShadowVerifier
}
internal bool IsFlatPass => _flatPass;
internal bool IsGraphPass => _graphPass;
internal CollisionShadowStats Stats => new(
_queries,
@ -52,7 +54,7 @@ internal sealed class CollisionShadowVerifier
internal bool TrySample(out long sample)
{
if (_flatPass)
if (_flatPass || _graphPass)
{
sample = 0;
return false;
@ -77,9 +79,9 @@ internal sealed class CollisionShadowVerifier
internal void BeginFlatPass()
{
if (_flatPass)
if (_flatPass || _graphPass)
throw new InvalidOperationException(
"Collision shadow flat passes cannot overlap.");
"Collision shadow passes cannot overlap.");
_flatPass = true;
}
@ -91,6 +93,22 @@ internal sealed class CollisionShadowVerifier
_flatPass = false;
}
internal void BeginGraphPass()
{
if (_flatPass || _graphPass)
throw new InvalidOperationException(
"Collision shadow passes cannot overlap.");
_graphPass = true;
}
internal void EndGraphPass()
{
if (!_graphPass)
throw new InvalidOperationException(
"No collision shadow graph pass is active.");
_graphPass = false;
}
internal void RecordBoolean(
long sample,
string kind,
@ -188,7 +206,8 @@ internal sealed class CollisionShadowVerifier
string kind,
uint sourceId,
Exception fault,
string input)
string input,
string authority = "graph")
{
_faults++;
WriteArtifact(new CollisionShadowMismatchArtifact(
@ -196,8 +215,8 @@ internal sealed class CollisionShadowVerifier
sample,
kind,
$"0x{sourceId:X8}",
"FlatFault",
"graph-authoritative",
authority == "flat" ? "GraphFault" : "FlatFault",
$"{authority}-authoritative",
$"{fault.GetType().FullName}: {fault.Message}",
input));
}