renderdoc.CaptureFrameCount

renderdoc.CaptureFrameCount

#Overview

name: renderdoc.CaptureFrameCount

This variable is created as a Console Variable (cvar).

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of renderdoc.CaptureFrameCount is to control the number of frames captured by RenderDoc, a graphics debugging tool, when integrated with Unreal Engine 5.

This setting variable is primarily used by the RenderDoc plugin, which is part of the Developer Tools module in Unreal Engine 5. The plugin is responsible for integrating RenderDoc functionality into the engine for graphics debugging purposes.

The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable, which means it can be changed at runtime through console commands or configuration files.

The associated variable CVarRenderDocCaptureFrameCount directly interacts with renderdoc.CaptureFrameCount. They share the same value and purpose.

Developers must be aware of the following when using this variable:

  1. If the value is set to 0 (default), RenderDoc will capture a single frame.
  2. If the value is greater than 0, RenderDoc will capture multiple frames, encompassing all activity in all viewports and editor windows.
  3. Setting this variable to a value greater than 1 implicitly enables the capture of all activity, similar to setting the CaptureAllActivity variable.

Best practices when using this variable include:

  1. Use it judiciously, as capturing multiple frames can significantly increase the size of the capture file and the time required for capture.
  2. Consider the performance impact when capturing multiple frames, especially in complex scenes or on less powerful hardware.
  3. Coordinate its use with other RenderDoc-related variables, such as CaptureAllActivity and CaptureDelayInSeconds, for more precise control over the capture process.

Regarding the associated variable CVarRenderDocCaptureFrameCount:

This is the actual console variable that controls the renderdoc.CaptureFrameCount setting. It’s used internally by the RenderDoc plugin to determine the number of frames to capture. The variable is checked in various parts of the plugin’s code, such as when determining if all activity should be captured and when setting up the capture parameters. Developers should interact with this variable through the console command system rather than directly modifying it in code.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Plugins/Developer/RenderDocPlugin/Source/RenderDocPlugin/Private/RenderDocPluginModule.cpp:66

Scope: file

Source code excerpt:

	TEXT("If > 0, RenderDoc will trigger the capture only after this amount of time (or frames, if CaptureDelayInSeconds is false) has passed."));
static TAutoConsoleVariable<int32> CVarRenderDocCaptureFrameCount(
	TEXT("renderdoc.CaptureFrameCount"),
	0,
	TEXT("If > 0, the RenderDoc capture will encompass more than a single frame. Note: this implies that all activity in all viewports and editor windows will be captured (i.e. same as CaptureAllActivity)"));

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Helper classes
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#Associated Variable and Callsites

This variable is associated with another variable named CVarRenderDocCaptureFrameCount. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Plugins/Developer/RenderDocPlugin/Source/RenderDocPlugin/Private/RenderDocPluginModule.cpp:65

Scope: file

Source code excerpt:

	0,
	TEXT("If > 0, RenderDoc will trigger the capture only after this amount of time (or frames, if CaptureDelayInSeconds is false) has passed."));
static TAutoConsoleVariable<int32> CVarRenderDocCaptureFrameCount(
	TEXT("renderdoc.CaptureFrameCount"),
	0,
	TEXT("If > 0, the RenderDoc capture will encompass more than a single frame. Note: this implies that all activity in all viewports and editor windows will be captured (i.e. same as CaptureAllActivity)"));

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Helper classes

#Loc: <Workspace>/Engine/Plugins/Developer/RenderDocPlugin/Source/RenderDocPlugin/Private/RenderDocPluginModule.cpp:360

Scope (from outer to inner):

file
function     bool FRenderDocPluginModule::ShouldCaptureAllActivity

Source code excerpt:

{
	// capturing more than 1 frame means that we can't just capture the current viewport : 
	return CVarRenderDocCaptureAllActivity.GetValueOnAnyThread() || (CVarRenderDocCaptureFrameCount.GetValueOnAnyThread() > 1);
}

void FRenderDocPluginModule::ShowNotification(const FText& Message, bool bForceNewNotification)
{
#if WITH_EDITOR
	FRenderDocPluginNotification::Get().ShowNotification(Message, bForceNewNotification);

#Loc: <Workspace>/Engine/Plugins/Developer/RenderDocPlugin/Source/RenderDocPlugin/Private/RenderDocPluginModule.cpp:426

Scope (from outer to inner):

file
function     void FRenderDocPluginModule::CaptureFrame

Source code excerpt:


		// store all CVars at beginning of capture in case they change while the capture is occurring : 
		CaptureFrameCount = CVarRenderDocCaptureFrameCount.GetValueOnAnyThread();
		bCaptureDelayInSeconds = CVarRenderDocCaptureDelayInSeconds.GetValueOnAnyThread() > 0;

		if (bCaptureDelayInSeconds)
		{
			DelayedCaptureSeconds = FPlatformTime::Seconds() + (double)FrameDelay;
		}