Skip to content

feat(renderdoc): add multi-frame captures#2355

Merged
alandtse merged 2 commits into
community-shaders:devfrom
ParticleTroned:pr/multicapture-renderdoc
May 18, 2026
Merged

feat(renderdoc): add multi-frame captures#2355
alandtse merged 2 commits into
community-shaders:devfrom
ParticleTroned:pr/multicapture-renderdoc

Conversation

@ParticleTroned
Copy link
Copy Markdown
Contributor

@ParticleTroned ParticleTroned commented May 16, 2026

Motivation:

When you want to troubleshoot flicker issues it is diffcult to capture the two frames with, e.g. with and without shadows for renderdoc analysis - well you could wildly press capture all the time...

The PR applies TriggerMultiFrameCapture from Renderdoc and allows to capture and save consecutive frames.
1 -> TriggerCapture()
2..120 -> TriggerMultiFrameCapture(frameCount)

renderPR

Summary by CodeRabbit

  • New Features
    • Added a configurable "Capture Frames" slider (1–120) to control multi-frame captures.
    • Capture hotkey handling improved: F12/SNAPSHOT support with modifier suppression and priority handling to avoid conflicts.
    • Capture creation now follows the configured multi-frame workflow and validates required disk space before starting.
    • Settings persist the capture frame count and restore sensible defaults when capture is disabled.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ee23adc3-9fdd-47ae-a017-d4892f5ae190

📥 Commits

Reviewing files that changed from the base of the PR and between bf14dd4 and c6e1eed.

📒 Files selected for processing (4)
  • features/RenderDoc/Shaders/Features/RenderDoc.ini
  • src/Features/RenderDoc.cpp
  • src/Features/RenderDoc.h
  • src/Menu.cpp
✅ Files skipped from review due to trivial changes (1)
  • features/RenderDoc/Shaders/Features/RenderDoc.ini
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/Features/RenderDoc.h
  • src/Features/RenderDoc.cpp

📝 Walkthrough

Walkthrough

Adds configurable multi-frame RenderDoc capture: UI slider, persisted frame-count setting, disk-space calculation and pre-check, multi-frame dispatch, F12/SNAPSHOT hotkey handling routed through Menu::ProcessInputEventQueue, and disables RenderDoc's internal hotkeys.

Changes

RenderDoc Configurable Multi-Frame Capture

Layer / File(s) Summary
RenderDoc contract and state
src/Features/RenderDoc.h
Added public declarations TriggerMultiFrameCapture() and HandleCaptureHotkey(), private helpers TriggerConfiguredCapture(), Get/SetCaptureFrameCount(), GetRequiredCaptureSpaceBytes(), HasSufficientDiskSpaceForConfiguredCapture(), new captureFrameCount member defaulting to 1, and constants kMinCaptureFrameCount/kMaxCaptureFrameCount and per-frame bytes guidance.
Hotkey initialization and capture dispatcher
src/Features/RenderDoc.cpp
Load() disables RenderDoc internal hotkeys via SetCaptureKeys(nullptr,0). Implements HandleCaptureHotkey() for F12/SNAPSHOT with modifier suppression and availability checks; TriggerMultiFrameCapture() and TriggerConfiguredCapture() dispatch single- vs multi-frame captures and optionally validate disk space.
Settings persistence for capture frame count
src/Features/RenderDoc.cpp
SaveSettings writes Capture Frame Count; LoadSettings reads numeric JSON values (unsigned or integer) and clamps to min/max; RestoreDefaultSettings resets frame count to 1 when disabling capture.
Settings UI and capture action flow
src/Features/RenderDoc.cpp
Adds "Capture Frames" slider bound to GetCaptureFrameCount()/SetCaptureFrameCount(). "Create Capture" now calls TriggerConfiguredCapture(false). Insufficient-disk-space popup shows required MB from GetRequiredCaptureSpaceBytes() instead of a fixed constant.
Menu input event queue integration
src/Menu.cpp
Includes Features/RenderDoc.h. Menu::ProcessInputEventQueue on key release calls globals::features::renderDoc.HandleCaptureHotkey(key) first; when it returns true the existing keyActions match/callback loop is skipped. Minor formatting edits in surrounding hotkey code included.
Feature INI version
features/RenderDoc/Shaders/Features/RenderDoc.ini
Bumps Version from 1-0-1 to 1-1-0.

Sequence Diagram(s)

sequenceDiagram
  participant MenuInput as Menu::ProcessInputEventQueue
  participant RenderDocHotkey as RenderDoc::HandleCaptureHotkey
  participant ConfiguredCapture as RenderDoc::TriggerConfiguredCapture
  participant DiskCheck as HasSufficientDiskSpaceForConfiguredCapture
  participant RenderDocAPI as RenderDocAPI

  MenuInput->>RenderDocHotkey: HandleCaptureHotkey(key)
  RenderDocHotkey->>ConfiguredCapture: TriggerConfiguredCapture(checkDisk=true)
  ConfiguredCapture->>DiskCheck: HasSufficientDiskSpaceForConfiguredCapture(&requiredBytes)
  DiskCheck-->>ConfiguredCapture: sufficient / insufficient
  ConfiguredCapture->>RenderDocAPI: TriggerCapture() or TriggerMultiFrameCapture(n)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • doodlum

Poem

🐰 A rabbit hops to press F12,

frames to gather, bytes to shelve.
From one to one-twenty in a sweep,
the capture settings wake from sleep.
Disk checks done — now sleep, don’t weep.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.56% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and directly summarizes the main feature addition: multi-frame capture support for RenderDoc, which is the primary purpose of this changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 OpenGrep (1.20.0)

OpenGrep fatal error (exit code 2): [00.13][ERROR]: Error: exception Unix_error: No such file or directory stat src/Features/RenderDoc.cpp
Raised by primitive operation at UTmp.replace_named_pipe_by_regular_file_if_needed in file "libs/commons/UTmp.ml", line 145, characters 8-27
Called from Scan_CLI.replace_target_roots_by_regular_files_where_needed.(fun) in file "src/osemgrep/cli_scan/Scan_CLI.ml", lines 1086-1087, characters 19-65
Called from List_.fast_map in file "libs/commons/List_.ml", line 81, characters 17-20
Called from S


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 16, 2026

No actionable suggestions for changed features.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/Menu.cpp (1)

25-25: ⚡ Quick win

Use the global feature registry here instead of the singleton.

This path already lives in the menu’s global feature dispatch, so globals::features::renderDoc.HandleCaptureHotkey(key) is a better fit than pulling in RenderDoc.h just to call GetSingleton(). That keeps feature access consistent and removes an otherwise unnecessary direct dependency.

As per coding guidelines, "Access core systems and feature registry through globals::features and globals::d3d namespaces defined in src/Globals.h".

Also applies to: 1076-1082

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Menu.cpp` at line 25, Replace direct singleton usage and include of
RenderDoc.h with the global feature registry: remove the `#include`
"Features/RenderDoc.h" and any calls to RenderDoc::GetSingleton() used to handle
capture hotkeys; instead call
globals::features::renderDoc.HandleCaptureHotkey(key) where the menu dispatch
invokes the feature (also update the similar occurrences around the other
instances referenced at 1076-1082). This keeps feature access consistent with
the globals::features registry and removes the unnecessary direct dependency.
src/Features/RenderDoc.h (1)

103-123: ⚡ Quick win

Keep the new frame-count state behind the clamp.

captureFrameCount lands in the public section, so external callers can bypass SetCaptureFrameCount() and write out-of-range values directly. That defeats the invariant this PR just introduced; please move the new state/bounds below a private: label or expose a public accessor instead.

Also applies to: 140-141

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Features/RenderDoc.h` around lines 103 - 123, The captureFrameCount field
is public and can be mutated bypassing the bounds enforced by
SetCaptureFrameCount(), so move captureFrameCount (and its related bounds/state)
below a private: label or make it private and add a public getter/setter that
enforces clamping; update any callers to use SetCaptureFrameCount() and ensure
pendingCommentsMutex, enableRenderDocCapture, and captureFrameCount are placed
consistently (private if they must be protected by invariants) to prevent
external out-of-range writes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/Features/RenderDoc.cpp`:
- Around line 737-740: Replace the optimistic kMinCaptureSpaceBytes *
GetCaptureFrameCount() with a conservative observed-per-frame estimate: change
RenderDoc::GetRequiredCaptureSpaceBytes() to compute required bytes as
(kObservedPerFrameBytes * GetCaptureFrameCount()) plus a fixed overhead cap
(e.g., kObservedCaptureOverheadBytes), and ensure there's still a minimum floor
(retain kMinCaptureSpaceBytes if desired). Use a new constant name like
kObservedPerFrameBytes (set to the empirically observed value ~220MB per frame
or your measured value) and update any callers such as
HasSufficientDiskSpaceForConfiguredCapture() to use this new function unchanged
so capacity checks use the conservative estimate.

---

Nitpick comments:
In `@src/Features/RenderDoc.h`:
- Around line 103-123: The captureFrameCount field is public and can be mutated
bypassing the bounds enforced by SetCaptureFrameCount(), so move
captureFrameCount (and its related bounds/state) below a private: label or make
it private and add a public getter/setter that enforces clamping; update any
callers to use SetCaptureFrameCount() and ensure pendingCommentsMutex,
enableRenderDocCapture, and captureFrameCount are placed consistently (private
if they must be protected by invariants) to prevent external out-of-range
writes.

In `@src/Menu.cpp`:
- Line 25: Replace direct singleton usage and include of RenderDoc.h with the
global feature registry: remove the `#include` "Features/RenderDoc.h" and any
calls to RenderDoc::GetSingleton() used to handle capture hotkeys; instead call
globals::features::renderDoc.HandleCaptureHotkey(key) where the menu dispatch
invokes the feature (also update the similar occurrences around the other
instances referenced at 1076-1082). This keeps feature access consistent with
the globals::features registry and removes the unnecessary direct dependency.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 08182eae-2555-4f85-a008-a0a4d4416b58

📥 Commits

Reviewing files that changed from the base of the PR and between 8c9b18c and bf14dd4.

📒 Files selected for processing (3)
  • src/Features/RenderDoc.cpp
  • src/Features/RenderDoc.h
  • src/Menu.cpp

Comment thread src/Features/RenderDoc.cpp
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 16, 2026

✅ A pre-release build is available for this PR:
Download

- Replace optimistic 100MB/frame disk space estimate with a
  conservative 256MB/frame observation; preserve the 100MB
  minimum floor so single-frame captures keep their old guard.
- Route the F12/SNAPSHOT hotkey dispatch through the
  globals::features::renderDoc registry instead of the singleton,
  matching the project convention.
- Bump RenderDoc feature version 1-0-1 -> 1-1-0 for the new
  multi-frame capture setting.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@alandtse alandtse merged commit 533a6bf into community-shaders:dev May 18, 2026
13 checks passed
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.

2 participants