chore(diag): add particle + punch/seal glFinish timers (ACDREAM_FPS_PROF) [throwaway]

Per-pass GPU attribution for the dense-town deep-dive: ParticleRenderer.Draw and
PortalDepthMaskRenderer.DrawDepthFan report into FrameProfiler [PASS-GPU]. Joins
the cells/terrain timers. glFinish serializes -> inflates absolutes; use for
relative attribution. STRIP with the rest of the apparatus when FPS work lands.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-06-23 18:21:58 +02:00
parent 8067d3b04a
commit 376f4e6190
2 changed files with 29 additions and 0 deletions

View file

@ -123,6 +123,11 @@ public sealed unsafe class ParticleRenderer : IDisposable
ParticleRenderPass renderPass = ParticleRenderPass.Scene,
Func<AcDream.Core.Vfx.ParticleEmitter, bool>? emitterFilter = null)
{
// THROWAWAY FPS apparatus: glFinish-bracket particle GPU (ACDREAM_FPS_PROF).
System.Diagnostics.Stopwatch? _pSw = null;
if (AcDream.App.Rendering.FrameProfiler.PassGpuEnabled) { _gl.Finish(); _pSw = System.Diagnostics.Stopwatch.StartNew(); }
try
{
if (particles is null || camera is null)
return;
@ -168,6 +173,15 @@ public sealed unsafe class ParticleRenderer : IDisposable
_gl.BindVertexArray(0);
_gl.DepthMask(true);
_gl.Disable(EnableCap.Blend);
}
finally
{
if (_pSw is not null)
{
_gl.Finish();
AcDream.App.Rendering.FrameProfiler.AddRendererGpu("particles", _pSw.Elapsed.TotalMilliseconds);
}
}
}
private List<ParticleDraw> BuildDrawList(

View file

@ -208,6 +208,12 @@ void main() { } // depth-only: color writes are masked off by the caller state
ReadOnlySpan<Vector4> planes,
bool forceFarZ)
{
// THROWAWAY FPS apparatus: glFinish-bracket each punch/seal fan (accumulated
// into "punchseal") under ACDREAM_FPS_PROF.
System.Diagnostics.Stopwatch? _fSw = null;
if (AcDream.App.Rendering.FrameProfiler.PassGpuEnabled) { _gl.Finish(); _fSw = System.Diagnostics.Stopwatch.StartNew(); }
try
{
if (worldVerts.Length < 3)
return;
int n = Math.Min(worldVerts.Length, MaxFanVerts);
@ -305,6 +311,15 @@ void main() { } // depth-only: color writes are masked off by the caller state
_gl.CullFace(TriangleFace.Back);
_gl.FrontFace(FrontFaceDirection.CW);
_gl.UseProgram(0);
}
finally
{
if (_fSw is not null)
{
_gl.Finish();
AcDream.App.Rendering.FrameProfiler.AddRendererGpu("punchseal", _fSw.Elapsed.TotalMilliseconds);
}
}
}
public void Dispose()