perf(mesher): shared proof-driven sampling skips certified-uniform blocks (L52); FI 7.1 -> 5.6 s; R21

The shared marching-cubes mesher applies its 8-cell block proofs at step 2 for standalone shape contexts
and skips density-grid fills outside certified-uniform blocks (plus a one-sample normal halo); mixed and
unknown blocks still sample exactly. FI certified-air boxes 1,959 -> 14,119; FI LOD1 samples -63%. FI whole
view 7.08 -> 5.61 s (-21%), moving p50 about -33%; SW unchanged. Geometry hashes identical (no version
bump); proof audit 36.9 M samples, 0 violations, Clang and GCC. Source stamp now covers the standalone
mesher copy. Research R21 (deepened): native Core cave generator design.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
This commit is contained in:
Fr0zkaandClaude Opus 5.5 committed 2026-10-24 23:53:43 +02:00
1 parent c42c785e2c
commit 408c14baff
5 files changed
+290 -10

No files matched your search

@@ -554,18 +554,20 @@ FVoxelMeshData UVoxelMarchingCubesMesher::GenerateMesh(FIntVector OriginVoxels,
MesherSetupTimer.End();
// Optional 8x8x8-cell block proof. Mixed/Unknown blocks always fall back to exact density
// sampling. The Core SurfaceWorld column-range proof at Step 2 can also omit evaluations
// outside active blocks and their one-sample normal halo.
// sampling. In the standalone shape route, certified solid/air blocks also omit density-grid
// fills outside active blocks and their one-sample normal halo.
TArray<uint8> BlockSkip;
int32 BlocksPerAxis = 0;
// Step 2 is enabled only for a tile wholly inside one native SurfaceWorld stratum. Steps
// 16/32 keep the historical gate off because their smaller grids do not amortize per-block queries.
// Step 2 is enabled for standalone shape proofs (or explicit proof audits). Steps 16/32 keep
// the historical gate off because their smaller grids do not amortize per-block queries.
const bool bNativeSurfaceTileProof = Step == 2 && ShapeWorldContext != nullptr
&& ShapeWorldContext->IsNativeSurfaceBox(OriginVoxels,Step,CellsPerAxis);
const bool bStandaloneShapeProof = ShapeWorldContext != nullptr;
const bool bUseProofBlocks = bUseBlockEarlyOut && !OutCaptureGrid
&& (Step == 1 || Step == 8 || (Step == 2
&& (bNativeSurfaceTileProof || OutBlockProofAudit != nullptr)));
bool bCanSkipProofBlockGrid = bNativeSurfaceTileProof;
&& (bNativeSurfaceTileProof || OutBlockProofAudit != nullptr
|| bStandaloneShapeProof)));
bool bCanSkipProofBlockGrid = Step <= 2 && bStandaloneShapeProof;
if (bUseProofBlocks)
{
constexpr int32 BlockCells = 8;
@@ -619,13 +621,17 @@ FVoxelMeshData UVoxelMarchingCubesMesher::GenerateMesh(FIntVector OriginVoxels,
{
const auto ShapeVerdict=ShapeWorldContext->ClassifyBoxDetailed(
BlockOrigin,Step,BlockCells,Step==2);
Verdict=ShapeVerdict.Verdict==EVoxelTileClass::AllSolid
Verdict=!ShapeVerdict.bUnknown
&&ShapeVerdict.Verdict==EVoxelTileClass::AllSolid
?EVoxelTileClass::AllSolid
:ShapeVerdict.Verdict==EVoxelTileClass::AllAir
:!ShapeVerdict.bUnknown
&&ShapeVerdict.Verdict==EVoxelTileClass::AllAir
?EVoxelTileClass::AllAir:EVoxelTileClass::Mixed;
bBlockUnknown=ShapeVerdict.bUnknown;
bBlockNative=ShapeVerdict.bNativeSurface;
if(Step==2&&!ShapeVerdict.bNativeSurface)
if((Verdict==EVoxelTileClass::AllSolid
||Verdict==EVoxelTileClass::AllAir)
&&(!bBlockNative||bBlockUnknown))
bCanSkipProofBlockGrid=false;
}
else
@@ -711,7 +717,7 @@ FVoxelMeshData UVoxelMarchingCubesMesher::GenerateMesh(FIntVector OriginVoxels,
if (Verdict == EVoxelTileClass::AllSolid
|| Verdict == EVoxelTileClass::AllAir)
{
if(OutBlockProofAudit&&Step==2&&bBlockNative)
if(OutBlockProofAudit&&Step<=2&&bBlockNative)
{
++OutBlockProofAudit->CheckedBlocks;
const int32 ProofMinX=BlockX*BlockCells-1;