skip: sound whole-tile proofs for legacy FI/TN/VS fields (L74); FI -30%, TN -22%
The compiled-analytic stratum interval now certifies a legacy tile uniform only when it stays beyond the detail envelope (and smooth-min slack for solid) with no intersecting primitive, edit, native field, composer candidate, passage or active transition; everything else fails closed. The stream layer uses the proof for whole-tile skips; legacy sub-tile skips stay off (two block proofs failed the falsifier in TN). Falsifier: full-grid reference vs skip-enabled run, identical mesh/payload/topology hashes on every tile of all four owner views, Clang and GCC, W1/W8/W12; 20-camera sweep per strate, 0 violations; a too-tight control changed 3/184/233/238 tiles and was caught. Whole view (8 workers): SW 2.61->2.48, FI 7.18->5.05, TN 5.97->4.63, VS 2.70->2.40 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
This commit is contained in:
1 parent
bd1b2a8f1d
commit
c67b2006aa
15 files changed
+1024
-21
No files matched your search
@@ -18,6 +18,7 @@
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
@@ -2155,6 +2156,7 @@ public:
|
||||
EVoxelTileClass Verdict=EVoxelTileClass::Mixed;
|
||||
bool bNativeSurface=false;
|
||||
bool bUnknown=false;
|
||||
bool bSkipSafe=false;
|
||||
};
|
||||
struct FClassificationThreadStats
|
||||
{
|
||||
@@ -5965,6 +5967,14 @@ public:
|
||||
return SharedDensitySource->ClassifyBoxDetailed(Origin,Step,Cells,bUseNativeLatticeProof);
|
||||
using Clock=std::chrono::steady_clock;
|
||||
const auto Start=Clock::now();
|
||||
static const bool bL74TightNegativeControl=[]
|
||||
{
|
||||
const char* Value=std::getenv("VOXELFORGE_L74_TIGHT_PROOF_CONTROL");
|
||||
const bool Enabled=Value&&Value[0]=='1'&&Value[1]=='\0';
|
||||
if(Enabled)
|
||||
std::printf("[L74NegativeControl] enabled=1 bound=base-sign-only-detail-and-primitive-envelope-omitted\n");
|
||||
return Enabled;
|
||||
}();
|
||||
const int32 Pad=std::max(Step,1);
|
||||
int32 BMin[3]={Origin.X-Pad,Origin.Y-Pad,Origin.Z-Pad};
|
||||
int32 BMax[3]={Origin.X+(Cells+1)*Step,Origin.Y+(Cells+1)*Step,Origin.Z+(Cells+1)*Step};
|
||||
@@ -6025,15 +6035,19 @@ public:
|
||||
bCaveOtherStrateOverlap=bCavesOverlap
|
||||
&&(bSurfaceOverlap||bIslandOverlap||bLegacyOverlap);
|
||||
}
|
||||
const auto Finish=[&](EVoxelTileClass Verdict,bool bUnknown=false)
|
||||
const auto Finish=[&](EVoxelTileClass Verdict,bool bUnknown=false,
|
||||
bool bLegacyAnalyticProof=false)
|
||||
{
|
||||
const bool bNative=(bSurfaceOverlap&&!bOtherStrateOverlap)
|
||||
||(bIslandOverlap&&!bIslandOtherStrateOverlap)
|
||||
||(bCavesOverlap&&!bCaveOtherStrateOverlap);
|
||||
FBoxClassification Result{Verdict,bNative,bUnknown};
|
||||
const bool bUniform=Verdict==EVoxelTileClass::AllAir
|
||||
||Verdict==EVoxelTileClass::AllSolid;
|
||||
FBoxClassification Result{Verdict,bNative,bUnknown,
|
||||
bLegacyAnalyticProof||(bNative&&!bUnknown&&bUniform)};
|
||||
auto& Counts=ThreadClassificationStats();
|
||||
Counts.Milliseconds+=std::chrono::duration<double,std::milli>(Clock::now()-Start).count();
|
||||
if(!Result.bNativeSurface||bUnknown)++Counts.UnknownBoxes;
|
||||
if(bUnknown)++Counts.UnknownBoxes;
|
||||
else if(Verdict==EVoxelTileClass::AllSolid)++Counts.SolidBoxes;
|
||||
else if(Verdict==EVoxelTileClass::AllAir)++Counts.AirBoxes;
|
||||
else ++Counts.MixedBoxes;
|
||||
@@ -6076,7 +6090,7 @@ public:
|
||||
static_cast<std::int64_t>(BMax[1])*Q,
|
||||
static_cast<std::int64_t>(BMax[2])*Q};
|
||||
caveCandidates=BuildCavernFeatureTileList(minimum,maximum);
|
||||
if(!caveCandidates.empty()&&!bCavesOverlap)
|
||||
if(!caveCandidates.empty()&&!bCavesOverlap&&!bL74TightNegativeControl)
|
||||
return Finish(EVoxelTileClass::Mixed,true);
|
||||
}
|
||||
if(ResolvedPassageIntersectsBox(BMin,BMax))
|
||||
@@ -6116,6 +6130,110 @@ public:
|
||||
return Finish(EVoxelTileClass::Mixed,true);
|
||||
}
|
||||
}
|
||||
// Boundary transitions can replace otherwise-air density with a solid seal and
|
||||
// can append a separate face mesh. Their authored bands were checked above; this
|
||||
// expanded window also covers the maximum XY displacement at every active seam.
|
||||
if(ResolvedLayout&&Owner&&Owner->CoreVoxelSizeMicrons>0)
|
||||
{
|
||||
const double ZMinimumMicrometres=static_cast<double>(BMin[2])
|
||||
*Owner->CoreVoxelSizeMicrons;
|
||||
const double ZMaximumMicrometres=static_cast<double>(BMax[2])
|
||||
*Owner->CoreVoxelSizeMicrons;
|
||||
for(const auto& Upper:ResolvedLayout->strates)
|
||||
{
|
||||
const auto* Lower=FindResolvedLayoutStratumByOrder(Upper.order+1);
|
||||
if(!Lower||!IsResolvedLayoutTransitionActive(Upper))continue;
|
||||
const double MaximumDisplacement=
|
||||
ResolvedTransitionMaximumFaceDisplacementMicrometres(Upper,*Lower);
|
||||
const double WindowMinimum=std::min(Upper.bedrock.bottomMicrometres,
|
||||
Lower->ceiling.bottomMicrometres)-MaximumDisplacement;
|
||||
const double WindowMaximum=std::max(Upper.bedrock.topMicrometres,
|
||||
Lower->ceiling.topMicrometres)+MaximumDisplacement;
|
||||
if(ZMaximumMicrometres>=WindowMinimum
|
||||
&&ZMinimumMicrometres<=WindowMaximum)
|
||||
return Finish(EVoxelTileClass::Mixed,true);
|
||||
}
|
||||
}
|
||||
const auto TryLegacyAnalyticProof=[&]() -> std::optional<EVoxelTileClass>
|
||||
{
|
||||
// The shared base shape may use packed occupancy, while its selected legacy
|
||||
// field remains the compiled strata distance plus bounded primitive/detail
|
||||
// terms. SurfaceWorld op stacks, native adapters, and any active composer
|
||||
// feature fail closed and keep using their existing path.
|
||||
if(!WorldAssembly||!Owner||!Owner->Manager
|
||||
||!ResolvedLayout||!Owner->Generator||bSurfaceOverlap||bCavesOverlap
|
||||
||(!bL74TightNegativeControl
|
||||
&&(!stampCandidates.empty()||!caveCandidates.empty()))
|
||||
||!EditBrushes.empty()||LayerRanges.empty()
|
||||
||ActiveSpatialBinSize<=0)return std::nullopt;
|
||||
const double LayoutWidth=GetResolvedLayoutChunkWidthVoxels();
|
||||
if(!(LayoutWidth>0.0)||!std::isfinite(LayoutWidth))return std::nullopt;
|
||||
const int32 FirstChunk=FMath::FloorToInt(static_cast<float>(BMin[2])/LayoutWidth);
|
||||
const int32 LastChunk=FMath::FloorToInt(static_cast<float>(BMax[2])/LayoutWidth);
|
||||
for(int32 ChunkZ=FirstChunk;ChunkZ<=LastChunk;++ChunkZ)
|
||||
{
|
||||
const FBoundStratumField* Bound=FindBoundStratumForChunk(ChunkZ);
|
||||
if(!Bound||Bound->Kind==FBoundStratumField::EKind::SurfaceWorld)
|
||||
return std::nullopt;
|
||||
if(Bound->Kind==FBoundStratumField::EKind::FloatingIslands)
|
||||
{
|
||||
// A missing FI plan is the owner's compiled-analytic fallback. Any
|
||||
// installed plan selects the native FI field and is outside this proof.
|
||||
if(Bound->IslandPlan)return std::nullopt;
|
||||
}
|
||||
if(Bound->Kind==FBoundStratumField::EKind::Caves)return std::nullopt;
|
||||
}
|
||||
for(int32 BZ=FloorDiv(BMin[2],ActiveSpatialBinSize);
|
||||
BZ<=FloorDiv(BMax[2],ActiveSpatialBinSize);++BZ)
|
||||
for(int32 BY=FloorDiv(BMin[1],ActiveSpatialBinSize);
|
||||
BY<=FloorDiv(BMax[1],ActiveSpatialBinSize);++BY)
|
||||
for(int32 BX=FloorDiv(BMin[0],ActiveSpatialBinSize);
|
||||
BX<=FloorDiv(BMax[0],ActiveSpatialBinSize);++BX)
|
||||
{
|
||||
const auto It=SpatialBins.find({BX,BY,BZ});
|
||||
if(It==SpatialBins.end())continue;
|
||||
for(const uint32 Id:It->second)
|
||||
{
|
||||
const FPrimitive& Primitive=Primitives[Id];
|
||||
bool Overlap=true;
|
||||
for(int32 Axis=0;Axis<3;++Axis)
|
||||
Overlap=Overlap
|
||||
&&Primitive.Max[Axis]+DetailBand>=BMin[Axis]
|
||||
&&Primitive.Min[Axis]-DetailBand<=BMax[Axis];
|
||||
if(Overlap&&!bL74TightNegativeControl)return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
const FInterval& Layer=LayerRanges.front();
|
||||
if(Layer.Hi<=Layer.Lo)return std::nullopt;
|
||||
const auto BaseAt=[&](double Z)
|
||||
{return std::min(Z-static_cast<double>(Layer.Lo),
|
||||
static_cast<double>(Layer.Hi)-Z);};
|
||||
const double Z0=static_cast<double>(BMin[2]);
|
||||
const double Z1=static_cast<double>(BMax[2]);
|
||||
const double Base0=BaseAt(Z0),Base1=BaseAt(Z1);
|
||||
const double BaseMinimum=std::min(Base0,Base1);
|
||||
double BaseMaximum=std::max(Base0,Base1);
|
||||
const double Peak=(static_cast<double>(Layer.Lo)+Layer.Hi)*0.5;
|
||||
if(Peak>=Z0&&Peak<=Z1)BaseMaximum=std::max(BaseMaximum,BaseAt(Peak));
|
||||
// With no active primitive, smooth-min sees only its +100000 sentinel;
|
||||
// its largest possible downward correction is 12/6 = 2 voxels. Keep
|
||||
// the entire resulting field outside the measured detail support (4.125).
|
||||
constexpr double DetailSupport=DetailSupremum+0.125;
|
||||
constexpr double SmoothMinSlack=StrataCaveBlendRadius/6.0;
|
||||
constexpr double SafetyEpsilon=1.0e-3;
|
||||
const double SolidMargin=bL74TightNegativeControl
|
||||
?SafetyEpsilon:DetailSupport+SmoothMinSlack+SafetyEpsilon;
|
||||
const double AirMargin=bL74TightNegativeControl
|
||||
?SafetyEpsilon:DetailSupport+SafetyEpsilon;
|
||||
if(BaseMinimum>SolidMargin)
|
||||
return EVoxelTileClass::AllSolid;
|
||||
if(BaseMaximum<-AirMargin)
|
||||
return EVoxelTileClass::AllAir;
|
||||
return std::nullopt;
|
||||
};
|
||||
if(const auto LegacyVerdict=TryLegacyAnalyticProof())
|
||||
return Finish(*LegacyVerdict,false,true);
|
||||
// A box crossing recipes cannot use one field interval; unknown composition stays Mixed.
|
||||
// Une boite qui traverse plusieurs recettes reste Mixed, car l'intervalle d'un seul champ ne suffit pas.
|
||||
if(bBadPlan||(bSurfaceOverlap&&(bIslandOverlap||bOtherStrateOverlap))
|
||||
|
||||
Reference in new issue
Block a user