diff --git a/src/AcDream.App/Rendering/ParticleRenderer.cs b/src/AcDream.App/Rendering/ParticleRenderer.cs index e47fc338..c5f5f453 100644 --- a/src/AcDream.App/Rendering/ParticleRenderer.cs +++ b/src/AcDream.App/Rendering/ParticleRenderer.cs @@ -123,6 +123,11 @@ public sealed unsafe class ParticleRenderer : IDisposable ParticleRenderPass renderPass = ParticleRenderPass.Scene, Func? 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 BuildDrawList( diff --git a/src/AcDream.App/Rendering/PortalDepthMaskRenderer.cs b/src/AcDream.App/Rendering/PortalDepthMaskRenderer.cs index 4f0a6436..79a48d2c 100644 --- a/src/AcDream.App/Rendering/PortalDepthMaskRenderer.cs +++ b/src/AcDream.App/Rendering/PortalDepthMaskRenderer.cs @@ -208,6 +208,12 @@ void main() { } // depth-only: color writes are masked off by the caller state ReadOnlySpan 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()