Cause found by profiling: room/SDF graph-cache churn (exact XY bounds + sample order rebuilt it constantly). Region grouping (one LOD3 tile: 1,084 -> 229 builds), taller-tile traversal for LOD6 (36,480 -> 12,160), extent-dependent cache slots, lambdas instead of recursive std::function. Serial ms/tile, 64 nearest tiles per level (before -> after): L0 50.4 -> 50.6, L1 112 -> 110, L2 24 -> 22, L3 223 -> 73, L4 269 -> 134, L5 393 -> 127, L6 283 -> 145. Hashes of all levels unchanged; parity 3,436/3,436 bit-identical. Full clipmap, 16 workers BelowNormal: full detail 66.6 s, all 12,054 tiles 175 s. In-stream L0 tail is high (median 83 ms, mean 198 ms, p95 669 ms) vs 51 ms serial. Streaming: recentre keeps the intersection, generates only missing tiles nearest/finest first; one crossing = exactly 441 new tiles in 6.1 s, no stale results. Lighting: normals already come from the density gradient; the striping was the squared headlamp; broad linear fill + warmer palette. Daytime CPU rule documented in Standalone/README.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MmSoF64BbRFmk9C3p1VsBJ
64 lines
3.1 KiB
PowerShell
64 lines
3.1 KiB
PowerShell
[CmdletBinding()]
|
|
param([string]$OutputName = 'VoxelForgeStandalone.exe')
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
$Root = [IO.Path]::GetFullPath($PSScriptRoot)
|
|
$BuildDir = Join-Path $Root 'Build'
|
|
$BinDir = Join-Path $Root 'bin'
|
|
if ([IO.Path]::GetFileName($OutputName) -ne $OutputName -or [IO.Path]::GetExtension($OutputName) -ne '.exe') {
|
|
throw "OutputName must be an executable filename, not a path: $OutputName"
|
|
}
|
|
$OutputPath = Join-Path $BinDir $OutputName
|
|
[IO.Directory]::CreateDirectory($BuildDir) | Out-Null
|
|
[IO.Directory]::CreateDirectory($BinDir) | Out-Null
|
|
$VcVars = 'E:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat'
|
|
if (-not (Test-Path -LiteralPath $VcVars -PathType Leaf)) { throw "MSVC environment script not found: $VcVars" }
|
|
|
|
$Sources = @(
|
|
(Join-Path $Root 'Source\StandaloneViewer.cpp'),
|
|
(Join-Path $Root 'Compat\UnrealPerlin.cpp'),
|
|
(Join-Path $Root 'Compat\StandaloneDataAssetGlue.cpp'),
|
|
(Join-Path $Root 'Source\VoxelForge\Private\VoxelBiomeDefinition.cpp'),
|
|
(Join-Path $Root 'Source\VoxelForge\Private\VoxelCaveMorphology.cpp'),
|
|
(Join-Path $Root 'Source\VoxelForge\Private\VoxelDensityAblation.cpp'),
|
|
(Join-Path $Root 'Source\VoxelForge\Private\VoxelDensityOpStack.cpp'),
|
|
(Join-Path $Root 'Source\VoxelForge\Private\VoxelDensityProfile.cpp'),
|
|
(Join-Path $Root 'Source\VoxelForge\Private\VoxelDiffLayer.cpp'),
|
|
(Join-Path $Root 'Source\VoxelForge\Private\VoxelGenerator.cpp'),
|
|
(Join-Path $Root 'Source\VoxelForge\Private\VoxelHeightOpStack.cpp'),
|
|
(Join-Path $Root 'Source\VoxelForge\Private\VoxelMarchingCubesMesher.cpp'),
|
|
(Join-Path $Root 'Source\VoxelForge\Private\VoxelSettings.cpp'),
|
|
(Join-Path $Root 'Source\VoxelForge\Private\VoxelStrateComposer.cpp'),
|
|
(Join-Path $Root 'Source\VoxelForge\Private\VoxelStrateManager.cpp'),
|
|
(Join-Path $Root 'Source\VoxelForge\Private\VoxelStrateMeasure.cpp'),
|
|
(Join-Path $Root 'Source\VoxelForge\Private\VoxelTerrainOpDefinition.cpp'),
|
|
(Join-Path $Root 'Source\VoxelForge\Private\VoxelWormField.cpp')
|
|
)
|
|
foreach ($Source in $Sources) {
|
|
if (-not (Test-Path -LiteralPath $Source -PathType Leaf)) { throw "Required source is missing: $Source" }
|
|
}
|
|
|
|
$ResponsePath = Join-Path $BuildDir 'standalone.rsp'
|
|
$RspLines = @(
|
|
'/nologo', '/std:c++20', '/O2', '/arch:AVX2', '/fp:precise', '/EHsc',
|
|
'/D_CRT_SECURE_NO_WARNINGS',
|
|
('/I"{0}"' -f (Join-Path $Root 'Compat')),
|
|
('/I"{0}"' -f (Join-Path $Root 'Source')),
|
|
('/I"{0}"' -f (Join-Path $Root 'Source\VoxelForge\Public')),
|
|
('/I"{0}"' -f (Join-Path $Root 'Source\VoxelForge\Private')),
|
|
('/Fe"{0}"' -f $OutputPath)
|
|
)
|
|
foreach ($Source in $Sources) { $RspLines += ('"{0}"' -f $Source) }
|
|
$RspLines += @('/link','d3d11.lib','dxgi.lib','d3dcompiler.lib','user32.lib','gdi32.lib')
|
|
[IO.File]::WriteAllLines($ResponsePath,$RspLines,[Text.UTF8Encoding]::new($false))
|
|
|
|
Push-Location $BuildDir
|
|
try {
|
|
$CommandLine = 'call "{0}" >nul && start /belownormal /wait cl.exe @"{1}"' -f $VcVars,$ResponsePath
|
|
& $env:ComSpec /d /s /c $CommandLine
|
|
if ($LASTEXITCODE -ne 0) { throw "Standalone MSVC build failed with exit code $LASTEXITCODE" }
|
|
} finally {
|
|
Pop-Location
|
|
}
|
|
Write-Host "Built $OutputPath"
|