chore(diag): FPS_PROF=2 clean split + [CPU-PHASE] DrawInside timers [throwaway]

Decouple the whole-frame TimeElapsed query from the per-pass glFinish so the
CPU-vs-GPU split is honest: ACDREAM_FPS_PROF=2 runs the frame query with NO
per-pass glFinish (PassGpuEnabled stays "1"-gated). Plus [CPU-PHASE] timers
around each DrawInside phase (flood/assemble/prepare/partition/landscape/
portalmask/shells/cellobjects/dynamics) — the CPU analog of [PASS-GPU].

This is what proved the dense town is ~96% CPU-bound (GPU=0.5ms) and that the
cost is per-cell draw submission (cellobjects ~3.5ms), not the portal floods /
punch-seal / clip allocs the static analysis had guessed. Throwaway; strip with
the rest of the FPS apparatus (plan Task 5).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-06-23 20:41:45 +02:00
parent 1473e4dbf9
commit fe1f81371a
3 changed files with 57 additions and 2 deletions

View file

@ -62,11 +62,17 @@ public sealed class GameWindow : IDisposable
private double _lastFps = 60.0;
private double _lastFrameMs = 16.7;
// THROWAWAY FPS-investigation apparatus (2026-06-23, ACDREAM_FPS_PROF=1):
// THROWAWAY FPS-investigation apparatus (2026-06-23):
// frame-level CPU/GPU/wall profiler to find the dense-town bottleneck. See
// FrameProfiler. Lazy-constructed on first OnRender once _gl is live.
// ACDREAM_FPS_PROF=1 — whole-frame query + per-pass glFinish brackets
// ([PASS-GPU]); the glFinish SERIALIZES the pipe so cpuRender/gpu/wall
// collapse together — relative per-pass attribution only.
// ACDREAM_FPS_PROF=2 — whole-frame TimeElapsed query ONLY, NO per-pass
// glFinish (PassGpuEnabled stays "1"-gated). This is the honest CPU-vs-GPU
// split: gpu≈wall+present>0 ⇒ GPU-bound; cpuRender≈wall+present≈0 ⇒ CPU-bound.
private readonly bool _fpsProf =
string.Equals(Environment.GetEnvironmentVariable("ACDREAM_FPS_PROF"), "1", StringComparison.Ordinal);
Environment.GetEnvironmentVariable("ACDREAM_FPS_PROF") is "1" or "2";
private FrameProfiler? _frameProfiler;
private int _msaaSamples;