perf(collision): cook stages measured, no standing on dug-out ground; review F/H/E measured

1. Collision cook breakdown (request -> ready), critical support tile:
   spawn (0,0,-1): generate 107 ms, apply < 1 ms, RMC submit->body 479 ms, total 587 ms;
   deep floor (0,0,-7): generate 82 ms, RMC 1,441 ms, total 1,548 ms.
   Almost all of the wait is inside RMC (end-of-frame update + async pool + Chaos cook + body
   install, not separable from our side). Critical priority does not shorten it. Collision is
   async, complex-as-simple, fast-cook off; skirts are ~16-18% of collision triangles.
   No cook change made. Startup outlier: first support tile waited 2.09 s for its game-thread apply.
   Underfoot dig: a carving brush that intersects the pawn's capsule and support tile now
   disables the old body and withdraws readiness on the carve frame: 0 frames standing on removed
   ground (replacement 91.8 ms later). 8 neighbouring digs: 0 gate frames. Gap audit 0.
2. Stack sampler, 49.4 s game path: top resolved leaf was the profiler's own
   VoxelDensityProfile::BucketFromName (4.86%). Linear label scan -> CRC-keyed lookup with exact
   compare: 59.26 -> 57.87 ms/tile (-2.35%), 980/980 tile hashes identical.
3. Measured only: F (classifier mode 1, no exact check) +48% worker CPU, 0/980 tiles differ ->
   not worth it. H (handoff component scans) p95 0.07 ms/frame -> not worth it.
   E (FullResClipLevels=1): worker CPU 56.7 -> 35.7 s, settle 9.6 -> 7.0 s, crossing samples
   -30%; changes the look, owner's decision.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MmSoF64BbRFmk9C3p1VsBJ
This commit is contained in:
Fr0zkaandClaude Opus 5.5 committed 2026-09-29 07:52:18 +02:00
1 parent ce6812dbeb
commit bf22f0ffe0
7 files changed
+356 -36

No files matched your search

+22 -2
View File
@@ -117,7 +117,7 @@ struct FChunkResult
uint64 GenerationEndCycles = 0;
uint64 ApplyStartCycles = 0;
EVoxelTileWorkPriority WorkPriority = EVoxelTileWorkPriority::Horizon;
int32 ClassifyVerdict = -1; double ClassifySeconds = 0.0; double MeshSeconds = 0.0; double StreamSeconds = 0.0; int32 NumTriangles = 0; int32 NumCeilingTriangles = 0;
int32 ClassifyVerdict = -1; double ClassifySeconds = 0.0; double MeshSeconds = 0.0; double StreamSeconds = 0.0; int32 NumTriangles = 0; int32 NumCeilingTriangles = 0; int32 NumSkirtTriangles = 0;
int32 NumVertices = 0;
uint64 GeometryBytes = 0;
bool bSealedSolidProof = false; // true when the cheap gap/seal proof skipped meshing
@@ -270,6 +270,11 @@ public:
* submission and LoadedTiles are intentionally not sufficient. */
TSet<FVoxelTileKey> CollisionReadyTiles;
/** A carve intersected the pawn's current support tile. Its previous body is withdrawn
* immediately and readiness returns only after the replacement cook is installed. */
TSet<FVoxelTileKey> CollisionSuppressedUntilCook;
TMap<FVoxelTileKey, uint64> CollisionSuppressedAtCycles;
/** Level-0 tiles whose applied result is known to contain no surface (uniform empty/solid).
* They need no BodySetup themselves, but the pawn gate may walk past them while looking for
* the first resolved collidable support tile. */
@@ -285,13 +290,27 @@ public:
uint64 SubmissionId = 0;
uint64 MeshSubmittedCycles = 0;
uint64 CollisionSubmittedCycles = 0;
uint64 CollisionSubmittedFrame = 0;
bool bBodyUpdatedEventSeen = false;
uint64 BodyUpdatedEventCycles = 0;
uint64 BodyUpdatedEventFrame = 0;
uint64 FutureCallbackCycles = 0;
uint64 CompletionGameThreadCycles = 0;
// Game-thread-only timing copied from the generation result for the clean LOD0 summary.
uint64 RequestStartCycles = 0;
uint64 GenerationStartCycles = 0;
uint64 GenerationEndCycles = 0;
uint64 ApplyStartCycles = 0;
EVoxelTileWorkPriority WorkPriority = EVoxelTileWorkPriority::Horizon;
int32 NumVertices = 0;
int32 NumTriangles = 0;
int32 NumSkirtTriangles = 0;
int32 PendingCooksAtSubmit = 0;
bool bUseAsyncCook = true;
bool bUseComplexAsSimpleCollision = true;
bool bShouldFastCookMeshes = false;
bool bMergeAllMeshes = false;
uint64 SuppressedAtCycles = 0;
bool bRecordStreamingLatency = false;
};
@@ -896,7 +915,8 @@ public:
/** Called by the RMC collision future after async cook + BodySetup installation. */
void HandleTileCollisionCookComplete(const FVoxelTileKey& Tile, uint64 SubmissionId,
URealtimeMesh* Mesh, uint8 Result);
URealtimeMesh* Mesh, uint8 Result,
uint64 FutureCallbackCycles);
void BindRealtimeMeshCollisionEvent(URealtimeMesh* Mesh);
void UnbindRealtimeMeshCollisionEvent(URealtimeMesh* Mesh);
void HandleRealtimeMeshCollisionBodyUpdated(URealtimeMesh* Mesh, UBodySetup* BodySetup);