profile: in-process SIGPROF sampler + exclusive route/phase census (L77); closes to 0.1%
Opt-in (L77 build + --linux77-profile; compiled out by default, 0.02% handler cost). FI/TN cost account closes against direct grid-fill timing within 0.15% (LOD0-2 bins within 1.4%). Passage carving = 66% of LOD0-2 CPU (52-54% whole view), passage support 10-14%, base packed + analytic field ~3%. Hotspots: value noise 17%, lower_bound in VisitNearestPassageSpatialNode 14%, ApplyResolvedStratePassageCarves 6.5%. LOD0/1 complete LAST (4.1/4.6 s) while LOD2 is ready at 2.2 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
68cba5a51d
commit
5e091d254c
14 files changed
+1205
-8
No files matched your search
@@ -5,6 +5,7 @@
|
||||
#include "VoxelHybridSharpMesher.h"
|
||||
#include "MarchingCubesTables.h"
|
||||
#include "StandaloneShapeWorld.h"
|
||||
#include "VoxelForgeCore/Linux77Profiler.h"
|
||||
#include "VoxelDensityProfile.h"
|
||||
#if WITH_EDITOR
|
||||
#include "VoxelRedefinedDensityField.h"
|
||||
@@ -1047,6 +1048,8 @@ FVoxelMeshData UVoxelMarchingCubesMesher::GenerateMesh(FIntVector OriginVoxels,
|
||||
// Bande de strate : seules les rangées Z réellement lues (cellules CzLo..CzHi + marges de
|
||||
// gradient) sont échantillonnées — le reste du tampon reste non initialisé et non lu.
|
||||
const uint64 StageDensityGridStartCycles=OutStageTimings?FPlatformTime::Cycles64():0;
|
||||
VoxelForgeCore::Linux77Profiler::FScopedStage l77GridFillStage(
|
||||
VoxelForgeCore::Linux77Profiler::EStage::GridFill);
|
||||
VoxelDensityProfile::FScopedTimer MesherDensityGridTimer(
|
||||
VoxelDensityProfile::EBucket::MesherDensityGrid);
|
||||
#if WITH_EDITOR
|
||||
@@ -1264,6 +1267,7 @@ FVoxelMeshData UVoxelMarchingCubesMesher::GenerateMesh(FIntVector OriginVoxels,
|
||||
const int32 SampleZ=OriginVoxels.Z+gz*Step;
|
||||
const bool bBoundarySample=gx<0||gx>GridDim||gy<0||gy>GridDim
|
||||
||gz<0||gz>GridDim;
|
||||
VoxelForgeCore::Linux77Profiler::FScopedHalo l77Halo(bBoundarySample);
|
||||
VoxelForgeCore::floating_island_detail::FScopedIslandFieldCaller islandCaller(
|
||||
bBoundarySample
|
||||
?VoxelForgeCore::floating_island_detail::EIslandFieldCaller::Boundary
|
||||
@@ -1272,6 +1276,11 @@ FVoxelMeshData UVoxelMarchingCubesMesher::GenerateMesh(FIntVector OriginVoxels,
|
||||
?ShapeWorldContext->DensityAtLattice(SampleX,SampleY,SampleZ)
|
||||
:Generator->GetDensityAtLattice(SampleX,SampleY,SampleZ,
|
||||
bCapturePreEditGrid ? &PreEditDensity : nullptr);
|
||||
if(OutStageTimings)
|
||||
{
|
||||
if(bBoundarySample)++OutStageTimings->DensityGridHaloSamples;
|
||||
else ++OutStageTimings->DensityGridInteriorSamples;
|
||||
}
|
||||
if (bCapturePreEditGrid)
|
||||
{
|
||||
OutPreEditDensityGrid->Samples[LocalIndex] = PreEditDensity;
|
||||
@@ -1304,6 +1313,7 @@ FVoxelMeshData UVoxelMarchingCubesMesher::GenerateMesh(FIntVector OriginVoxels,
|
||||
float Densities[8]{};
|
||||
const bool bBoundarySample=GX0<0||GX0+BatchCount-1>GridDim
|
||||
||gy<0||gy>GridDim||gz<0||gz>GridDim;
|
||||
VoxelForgeCore::Linux77Profiler::FScopedHalo l77Halo(bBoundarySample);
|
||||
VoxelForgeCore::floating_island_detail::FScopedIslandFieldCaller islandCaller(
|
||||
bBoundarySample
|
||||
?VoxelForgeCore::floating_island_detail::EIslandFieldCaller::Boundary
|
||||
@@ -1314,6 +1324,14 @@ FVoxelMeshData UVoxelMarchingCubesMesher::GenerateMesh(FIntVector OriginVoxels,
|
||||
{
|
||||
++OutStageTimings->X8DensityCalls;
|
||||
OutStageTimings->X8ActiveLanes+=static_cast<uint64>(BatchCount);
|
||||
for(int32 Lane=0;Lane<BatchCount;++Lane)
|
||||
{
|
||||
const int32 SampleGX=GX0+Lane;
|
||||
if(SampleGX<0||SampleGX>GridDim||gy<0||gy>GridDim
|
||||
||gz<0||gz>GridDim)
|
||||
++OutStageTimings->DensityGridHaloSamples;
|
||||
else ++OutStageTimings->DensityGridInteriorSamples;
|
||||
}
|
||||
}
|
||||
for(int32 Lane=0;Lane<BatchCount;++Lane)
|
||||
{
|
||||
@@ -1350,12 +1368,24 @@ FVoxelMeshData UVoxelMarchingCubesMesher::GenerateMesh(FIntVector OriginVoxels,
|
||||
float Densities[CHUNK_SIZE+3]{};
|
||||
const bool bBoundarySample=gx<0||gx>GridDim||gy<0||gy>GridDim
|
||||
||GzLo<0||GzHi>GridDim;
|
||||
VoxelForgeCore::Linux77Profiler::FScopedHalo l77Halo(bBoundarySample);
|
||||
VoxelForgeCore::floating_island_detail::FScopedIslandFieldCaller islandCaller(
|
||||
bBoundarySample
|
||||
?VoxelForgeCore::floating_island_detail::EIslandFieldCaller::Boundary
|
||||
:VoxelForgeCore::floating_island_detail::EIslandFieldCaller::GridFill);
|
||||
ActiveShapeWorld->DensityAtLatticeZRun(SampleX,SampleY,
|
||||
OriginVoxels.Z+GzLo*Step,Step,BatchCount,Densities);
|
||||
if(OutStageTimings)
|
||||
{
|
||||
for(int32 Lane=0;Lane<BatchCount;++Lane)
|
||||
{
|
||||
const int32 LocalGz=GzLo+Lane;
|
||||
if(gx<0||gx>GridDim||gy<0||gy>GridDim
|
||||
||LocalGz<0||LocalGz>GridDim)
|
||||
++OutStageTimings->DensityGridHaloSamples;
|
||||
else ++OutStageTimings->DensityGridInteriorSamples;
|
||||
}
|
||||
}
|
||||
for(int32 Lane=0;Lane<BatchCount;++Lane)
|
||||
{
|
||||
const int32 LocalGz=GzLo+Lane;
|
||||
@@ -1505,6 +1535,7 @@ FVoxelMeshData UVoxelMarchingCubesMesher::GenerateMesh(FIntVector OriginVoxels,
|
||||
const int32 SampleY=OriginVoxels.Y+gy*Step;
|
||||
const int32 SampleZ=OriginVoxels.Z+gz*Step;
|
||||
const bool bBoundarySample=gx<0||gx>GridDim||gy<0||gy>GridDim;
|
||||
VoxelForgeCore::Linux77Profiler::FScopedHalo l77Halo(bBoundarySample);
|
||||
VoxelForgeCore::floating_island_detail::FScopedIslandFieldCaller islandCaller(
|
||||
bBoundarySample
|
||||
?VoxelForgeCore::floating_island_detail::EIslandFieldCaller::Boundary
|
||||
@@ -1527,6 +1558,9 @@ FVoxelMeshData UVoxelMarchingCubesMesher::GenerateMesh(FIntVector OriginVoxels,
|
||||
}
|
||||
}
|
||||
MesherDensityGridTimer.End();
|
||||
l77GridFillStage.Restore();
|
||||
VoxelForgeCore::Linux77Profiler::FScopedStage l77MarchingCubesStage(
|
||||
VoxelForgeCore::Linux77Profiler::EStage::MarchingCubes);
|
||||
if(OutStageTimings)
|
||||
OutStageTimings->DensityGridMilliseconds=static_cast<double>(
|
||||
FPlatformTime::Cycles64()-StageDensityGridStartCycles)
|
||||
@@ -2119,6 +2153,9 @@ FVoxelMeshData UVoxelMarchingCubesMesher::GenerateMesh(FIntVector OriginVoxels,
|
||||
const int32 CapSurfaceTriangleCount=CapTris.Num()/3;
|
||||
TArray<uint8> GroundSkirtFaceMasks,CapSkirtFaceMasks;
|
||||
const uint64 SkirtStageStartCycles=OutStageTimings?FPlatformTime::Cycles64():0;
|
||||
l77MarchingCubesStage.Restore();
|
||||
VoxelForgeCore::Linux77Profiler::FScopedStage l77SkirtStage(
|
||||
VoxelForgeCore::Linux77Profiler::EStage::Skirt);
|
||||
VoxelForgeCore::floating_island_detail::FScopedIslandFieldCaller skirtFieldCaller(
|
||||
VoxelForgeCore::floating_island_detail::EIslandFieldCaller::Skirt);
|
||||
if (bGenerateSkirts && (GroundTris.Num() + CapTris.Num()) > 0)
|
||||
@@ -2382,6 +2419,9 @@ FVoxelMeshData UVoxelMarchingCubesMesher::GenerateMesh(FIntVector OriginVoxels,
|
||||
OutStageTimings->SkirtMilliseconds=static_cast<double>(
|
||||
FPlatformTime::Cycles64()-SkirtStageStartCycles)
|
||||
*FPlatformTime::GetSecondsPerCycle64()*1000.0;
|
||||
l77SkirtStage.Restore();
|
||||
VoxelForgeCore::Linux77Profiler::FScopedStage l77MesherFinalStage(
|
||||
VoxelForgeCore::Linux77Profiler::EStage::MarchingCubes);
|
||||
|
||||
// F17 — concatène sol PUIS sky-cap : un run d'indices contigu par polygroup (voir
|
||||
// FVoxelMeshData::NumCeilingTriangles). Mêmes triangles qu'avant, seul l'ordre change.
|
||||
|
||||
Reference in new issue
Block a user