Skip to content

Add background capture thread and live mode UI to DebugLayer - #13

Merged
Konstantysz merged 1 commit into
devfrom
feature/debuglayer-background-capture
Mar 9, 2026
Merged

Add background capture thread and live mode UI to DebugLayer#13
Konstantysz merged 1 commit into
devfrom
feature/debuglayer-background-capture

Conversation

@Konstantysz

Copy link
Copy Markdown
Owner

Summary

  • ProcessCurrentFrame() refactored into ProcessFrame(const Core::Frame &) — takes frame directly, no seek/grab inside
  • New GrabCurrentReplayFrame() handles replay-mode seek+grab+process (with lastProcessedFrame guard)
  • New StartCaptureThread() runs a background thread that calls source->Grab() in a loop and writes to a single-slot latestFrame (mutex-protected)
  • OnUpdate() dispatches: live → take from latestFrame + ProcessFrame; replay → existing playback.Update() + GrabCurrentReplayFrame()
  • Destructor stops capture thread (captureRunning = false + join()) before ImGui/GL teardown
  • FPS counter updated once per second in OnUpdate() from totalFramesGrabbed (atomic)
  • RenderPlaybackControls(): live mode shows ● LIVE X.X fps | N frames, no scrubber; replay mode unchanged
  • RenderStatePanel(): live mode shows frame count, replay mode shows frame index / total

Test plan

  • All 169 tests pass (no regressions)
  • Replay mode: behavior identical to v0.1.0 (seek, scrubber, play/pause/step all work)
  • Texture uploads remain on render thread — ProcessFrame() only called from OnUpdate() (render thread)
  • Destructor: captureThread.join() called before GL teardown — no std::terminate

Closes #7

@Konstantysz
Konstantysz merged commit 7da099b into dev Mar 9, 2026
1 check failed
@Konstantysz
Konstantysz deleted the feature/debuglayer-background-capture branch March 9, 2026 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant