wip(l62): shared boundary-sample cache + hidden skirt skip -- PARKED: SW +8.5%, moving p50 +119..265%, full tier incomplete
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
135957831b
commit
6ae5c4460d
12 files changed
+705
-111
No files matched your search
@@ -105,34 +105,7 @@ namespace
|
||||
uint8 ComputeVisibleSkirtFaceMask(const FVoxelTileKey& Tile,
|
||||
const std::unordered_set<FVoxelTileKey,FStandaloneTileKeyHash>& Desired)
|
||||
{
|
||||
const FIntVector Origin=Tile.OriginVoxels();
|
||||
const int32 Extent=Tile.ExtentVoxels();
|
||||
const auto FloorDiv=[](int64 Value,int64 Divisor)
|
||||
{
|
||||
int64 Quotient=Value/Divisor;
|
||||
if(Value%Divisor<0)--Quotient;
|
||||
return static_cast<int32>(Quotient);
|
||||
};
|
||||
uint8 Mask=0;
|
||||
for(int32 Axis=0;Axis<3;++Axis)
|
||||
for(int32 Side=0;Side<2;++Side)
|
||||
{
|
||||
int64 Probe[3]={Origin.X+Extent/2,Origin.Y+Extent/2,Origin.Z+Extent/2};
|
||||
Probe[Axis]=Side?static_cast<int64>((&Origin.X)[Axis])+Extent
|
||||
:static_cast<int64>((&Origin.X)[Axis])-1;
|
||||
int32 NeighborLevel=-1;
|
||||
for(int32 Level=0;Level<=8;++Level)
|
||||
{
|
||||
const int64 NeighborExtent=static_cast<int64>(CHUNK_SIZE)<<Level;
|
||||
const FIntVector Coord(FloorDiv(Probe[0],NeighborExtent),
|
||||
FloorDiv(Probe[1],NeighborExtent),FloorDiv(Probe[2],NeighborExtent));
|
||||
if(Desired.contains(FVoxelTileKey(Coord,Level)))
|
||||
{NeighborLevel=Level;break;}
|
||||
}
|
||||
if(NeighborLevel<0||NeighborLevel!=Tile.Level)
|
||||
Mask|=static_cast<uint8>(1u<<(Axis*2+Side));
|
||||
}
|
||||
return Mask;
|
||||
return ComputeStandaloneVisibleSkirtFaceMask(Tile,Desired);
|
||||
}
|
||||
|
||||
FMeshArtifactAudit AuditMeshArtifacts(const FStandaloneCpuTile& Tile,
|
||||
@@ -4845,14 +4818,15 @@ float3 Lit=Rock*(Ambient+0.88*Diffuse)+float3(0.50,0.69,0.82)*Head*0.75;
|
||||
|
||||
void RefreshResidentSkirtMasks()
|
||||
{
|
||||
for(auto& [Key,Resident]:ResidentTiles)
|
||||
std::vector<FVoxelTileKey> Invalidate;
|
||||
for(const auto& [Key,Resident]:ResidentTiles)
|
||||
{
|
||||
if(!DesiredTileSet.contains(Key))continue;
|
||||
const uint8 NewMask=ComputeVisibleSkirtFaceMask(Key,DesiredTileSet);
|
||||
if(NewMask==Resident.ActiveSkirtFaceMask)continue;
|
||||
Resident.ActiveSkirtFaceMask=NewMask;
|
||||
MarkBatchDirty(BatchForTile(Key));
|
||||
Invalidate.push_back(Key);
|
||||
}
|
||||
for(const FVoxelTileKey& Key:Invalidate)RemoveResidentTile(Key);
|
||||
}
|
||||
|
||||
static bool TileKeyLess(const FVoxelTileKey& A,const FVoxelTileKey& B)
|
||||
@@ -7010,6 +6984,8 @@ float3 Lit=Rock*(Ambient+0.88*Diffuse)+float3(0.50,0.69,0.82)*Head*0.75;
|
||||
double NativeMeshingMilliseconds=0.0;
|
||||
uint64 WholeSolidBoxes=0,WholeAirBoxes=0,WholeMixedBoxes=0,WholeUnknownBoxes=0;
|
||||
uint64 WholeFieldCalls=0,WholeColumnHits=0,WholeColumnMisses=0,WholeTileSkips=0;
|
||||
uint64 WholeColumnRepeats=0,WholeColumnComputes=0,WholeSampleCacheHits=0,WholeSampleCacheComputes=0;
|
||||
uint64 WholeSkirtTrianglesEmitted=0,WholeSkirtTriangleSeedsSkipped=0;
|
||||
uint64 WholeFloatFieldCalls=0,WholeLatticeFieldCalls=0,WholeUnclampedFieldCalls=0;
|
||||
double WholeClassificationMilliseconds=0.0,WholeColumnComputeMilliseconds=0.0;
|
||||
double WholeMeshingMilliseconds=0.0;
|
||||
@@ -7022,6 +6998,9 @@ float3 Lit=Rock*(Ambient+0.88*Diffuse)+float3(0.50,0.69,0.82)*Head*0.75;
|
||||
uint64 WholeFloatFieldCallsByLevel[MaxLevels+1]{},WholeLatticeFieldCallsByLevel[MaxLevels+1]{};
|
||||
uint64 WholeUnclampedFieldCallsByLevel[MaxLevels+1]{};
|
||||
uint64 WholeColumnMissesByLevel[MaxLevels+1]{},WholeTileSkipsByLevel[MaxLevels+1]{};
|
||||
uint64 WholeColumnRepeatsByLevel[MaxLevels+1]{},WholeColumnComputesByLevel[MaxLevels+1]{};
|
||||
uint64 WholeSampleCacheHitsByLevel[MaxLevels+1]{},WholeSampleCacheComputesByLevel[MaxLevels+1]{};
|
||||
uint64 WholeSkirtTrianglesEmittedByLevel[MaxLevels+1]{},WholeSkirtTriangleSeedsSkippedByLevel[MaxLevels+1]{};
|
||||
double WholeClassificationMillisecondsByLevel[MaxLevels+1]{};
|
||||
double WholeColumnComputeMillisecondsByLevel[MaxLevels+1]{};
|
||||
double WholeMeshingMillisecondsByLevel[MaxLevels+1]{};
|
||||
@@ -7086,6 +7065,13 @@ float3 Lit=Rock*(Ambient+0.88*Diffuse)+float3(0.50,0.69,0.82)*Head*0.75;
|
||||
WholeUnclampedFieldCalls+=Tile.CoreDiagnostics.unclampedFieldCalls;
|
||||
WholeColumnHits+=Tile.CoreDiagnostics.columnCacheHits;
|
||||
WholeColumnMisses+=Tile.CoreDiagnostics.columnCacheMisses;
|
||||
WholeColumnRepeats+=Tile.CoreDiagnostics.columnCacheHits
|
||||
+Tile.CoreDiagnostics.sharedColumnCacheHits;
|
||||
WholeColumnComputes+=Tile.CoreDiagnostics.columnEvaluations;
|
||||
WholeSampleCacheHits+=Tile.CoreDiagnostics.densitySampleCacheHits;
|
||||
WholeSampleCacheComputes+=Tile.CoreDiagnostics.densitySampleCacheComputes;
|
||||
WholeSkirtTrianglesEmitted+=Tile.CoreDiagnostics.marchingCubesSkirtTrianglesEmitted;
|
||||
WholeSkirtTriangleSeedsSkipped+=Tile.CoreDiagnostics.marchingCubesSkirtTriangleSeedsSkipped;
|
||||
WholeTileSkips+=Tile.CoreDiagnostics.meshingSkipped?1u:0u;
|
||||
WholeCapRefinedTiles+=Tile.CoreDiagnostics.capRefined?1u:0u;
|
||||
WholeCapRefinedCells+=Tile.CoreDiagnostics.capRefinedCells;
|
||||
@@ -7113,6 +7099,15 @@ float3 Lit=Rock*(Ambient+0.88*Diffuse)+float3(0.50,0.69,0.82)*Head*0.75;
|
||||
WholeUnclampedFieldCallsByLevel[Level]+=Tile.CoreDiagnostics.unclampedFieldCalls;
|
||||
WholeColumnHitsByLevel[Level]+=Tile.CoreDiagnostics.columnCacheHits;
|
||||
WholeColumnMissesByLevel[Level]+=Tile.CoreDiagnostics.columnCacheMisses;
|
||||
WholeColumnRepeatsByLevel[Level]+=Tile.CoreDiagnostics.columnCacheHits
|
||||
+Tile.CoreDiagnostics.sharedColumnCacheHits;
|
||||
WholeColumnComputesByLevel[Level]+=Tile.CoreDiagnostics.columnEvaluations;
|
||||
WholeSampleCacheHitsByLevel[Level]+=Tile.CoreDiagnostics.densitySampleCacheHits;
|
||||
WholeSampleCacheComputesByLevel[Level]+=Tile.CoreDiagnostics.densitySampleCacheComputes;
|
||||
WholeSkirtTrianglesEmittedByLevel[Level]
|
||||
+=Tile.CoreDiagnostics.marchingCubesSkirtTrianglesEmitted;
|
||||
WholeSkirtTriangleSeedsSkippedByLevel[Level]
|
||||
+=Tile.CoreDiagnostics.marchingCubesSkirtTriangleSeedsSkipped;
|
||||
WholeTileSkipsByLevel[Level]+=Tile.CoreDiagnostics.meshingSkipped?1u:0u;
|
||||
WholeClassificationMillisecondsByLevel[Level]
|
||||
+=Tile.CoreDiagnostics.classificationMilliseconds;
|
||||
@@ -7378,7 +7373,7 @@ float3 Lit=Rock*(Ambient+0.88*Diffuse)+float3(0.50,0.69,0.82)*Head*0.75;
|
||||
if(CoreWorld)
|
||||
for(int32 Level=0;Level<=MaxLevels;++Level)
|
||||
if(TilesByLevel[Level]>0)
|
||||
std::printf("[WorldAssemblerLODProfile] lod=%d tiles=%llu solid_boxes=%llu air_boxes=%llu mixed_boxes=%llu unknown_boxes=%llu whole_tile_skips=%llu field_calls=%llu float_field_calls=%llu lattice_field_calls=%llu unclamped_field_calls=%llu column_hits=%llu column_misses=%llu column_compute_worker_ms=%.3f classification_worker_ms=%.3f meshing_worker_ms=%.3f\n",
|
||||
std::printf("[WorldAssemblerLODProfile] lod=%d tiles=%llu solid_boxes=%llu air_boxes=%llu mixed_boxes=%llu unknown_boxes=%llu whole_tile_skips=%llu field_calls=%llu float_field_calls=%llu lattice_field_calls=%llu unclamped_field_calls=%llu column_hits=%llu column_misses=%llu column_computes=%llu column_repeats=%llu sample_cache_computes=%llu sample_cache_hits=%llu skirt_triangles_emitted=%llu skirt_triangle_seeds_skipped=%llu column_compute_worker_ms=%.3f classification_worker_ms=%.3f meshing_worker_ms=%.3f\n",
|
||||
Level,static_cast<unsigned long long>(TilesByLevel[Level]),
|
||||
static_cast<unsigned long long>(WholeSolidBoxesByLevel[Level]),
|
||||
static_cast<unsigned long long>(WholeAirBoxesByLevel[Level]),
|
||||
@@ -7391,6 +7386,12 @@ float3 Lit=Rock*(Ambient+0.88*Diffuse)+float3(0.50,0.69,0.82)*Head*0.75;
|
||||
static_cast<unsigned long long>(WholeUnclampedFieldCallsByLevel[Level]),
|
||||
static_cast<unsigned long long>(WholeColumnHitsByLevel[Level]),
|
||||
static_cast<unsigned long long>(WholeColumnMissesByLevel[Level]),
|
||||
static_cast<unsigned long long>(WholeColumnComputesByLevel[Level]),
|
||||
static_cast<unsigned long long>(WholeColumnRepeatsByLevel[Level]),
|
||||
static_cast<unsigned long long>(WholeSampleCacheComputesByLevel[Level]),
|
||||
static_cast<unsigned long long>(WholeSampleCacheHitsByLevel[Level]),
|
||||
static_cast<unsigned long long>(WholeSkirtTrianglesEmittedByLevel[Level]),
|
||||
static_cast<unsigned long long>(WholeSkirtTriangleSeedsSkippedByLevel[Level]),
|
||||
WholeColumnComputeMillisecondsByLevel[Level],
|
||||
WholeClassificationMillisecondsByLevel[Level],
|
||||
WholeMeshingMillisecondsByLevel[Level]);
|
||||
|
||||
Reference in new issue
Block a user