chore(diag): dense-town FPS profiling apparatus (ACDREAM_FPS_PROF) [throwaway]

FrameProfiler (frame/update/render/present/gpu split + per-renderer glFinish
attribution) + OnRender/OnUpdate hooks + terrain & EnvCell glFinish timers +
the degrade-coverage probe test. Used to root-cause the dense-town FPS; STRIP
when the fix lands (mirrors 92e95be).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-06-23 15:49:18 +02:00
parent fd9354f69e
commit e27923b4b5
4 changed files with 482 additions and 0 deletions

View file

@ -836,6 +836,18 @@ public sealed unsafe class EnvCellRenderer : IDisposable
/// </summary>
public void Render(WbRenderPass renderPass, HashSet<uint>? filter)
{
// THROWAWAY FPS apparatus (ACDREAM_FPS_PROF=1): glFinish-bracket this cell
// draw so the profiler can attribute its exact GPU cost. Serializes the
// pipeline (inflates frame time) but isolates cell-draw GPU at a held view.
System.Diagnostics.Stopwatch? _passSw = null;
if (AcDream.App.Rendering.FrameProfiler.PassGpuEnabled)
{
_gl.Finish();
_passSw = System.Diagnostics.Stopwatch.StartNew();
}
try
{
// WB EnvCellRenderManager.cs:400:
if (!_initialized || _shader is null || _shader.Program == 0) return;
@ -1030,6 +1042,15 @@ public sealed unsafe class EnvCellRenderer : IDisposable
System.Console.WriteLine(sb.ToString());
}
}
}
finally
{
if (_passSw is not null)
{
_gl.Finish();
AcDream.App.Rendering.FrameProfiler.AddRendererGpu("cells", _passSw.Elapsed.TotalMilliseconds);
}
}
}
// ---------------------------------------------------------------------------