mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-13 09:39:33 +01:00
The frame profiler kept its state in 4 thread slots, and every thread after the fourth shared the last one's nesting depth and stack without locking. Several threads entering and leaving scopes at once corrupted the depth, which then indexed outside the arrays and crashed. Now each thread that enters a scope gets a lane of its own: a ring of begin and end events that only it writes. A thread that exits hands its lane to the next new one; lanes are never freed, so readers can walk them without locks, and a reader checks that an event wasn't overwritten while it copied it. A literal scope name is looked up once per call site. The per-frame totals (time in each category, not counting nested scopes) are worked out from the events at each frame end, so the on-screen overlay keeps working. The ImGui debugger gets a CPU profiler window, with a zoomable timeline of each thread's scopes and frame ends plus a table of per-frame totals, and a Frame profile window with the overlay's graph, per thread. The Vulkan render thread has scopes for rendering, submitting and presenting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>