r.DynamicRes.DynamicFrameTime.Track
r.DynamicRes.DynamicFrameTime.Track
#Overview
name: r.DynamicRes.DynamicFrameTime.Track
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
What to track to control the budget\n 0: Frametime (but can create feedback loop when GPU bound and VSync); 1: Threads time (default);
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.DynamicRes.DynamicFrameTime.Track is to control what aspect of frame time is tracked for dynamic resolution in Unreal Engine 5. It is part of the dynamic resolution system, which adjusts the rendering resolution in real-time to maintain performance targets.
This setting variable is primarily used in the dynamic resolution subsystem, which is part of the rendering module in Unreal Engine. Based on the callsites, it’s implemented in the DynamicResolution.cpp file within the Engine’s Runtime source.
The value of this variable is set through a console variable (CVar) system. It’s defined as a TAutoConsoleVariable with a default value of 1, meaning it tracks threads time by default.
The associated variable CVarDynamicFrameTimeTrack interacts directly with r.DynamicRes.DynamicFrameTime.Track. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable affects how the dynamic resolution system measures performance. Setting it to 0 will track overall frame time, while setting it to 1 (default) will track threads time. The comment in the code warns that using frame time (0) can create a feedback loop when GPU-bound and using VSync.
Best practices when using this variable include:
- Generally, leave it at the default value (1) unless there’s a specific reason to change it.
- If changing to frame time tracking (0), be cautious of potential feedback loops in GPU-bound scenarios with VSync enabled.
- Monitor performance closely after changing this setting to ensure it’s having the desired effect.
Regarding the associated variable CVarDynamicFrameTimeTrack:
- Its purpose is the same as r.DynamicRes.DynamicFrameTime.Track, serving as the internal representation of the console variable.
- It’s used directly in the FDynamicResolutionHeuristicProxy::RefreshCurrentFrameResolutionFraction_RenderThread function to determine which frame time metric to use.
- The value is retrieved on the render thread using GetValueOnRenderThread(), indicating it’s designed for thread-safe access in rendering code.
- Developers should treat it as read-only in most cases, using the console variable to change its value rather than modifying it directly in code.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DynamicResolution.cpp:57
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarDynamicFrameTimeTrack(
TEXT("r.DynamicRes.DynamicFrameTime.Track"), 1,
TEXT("What to track to control the budget\n")
TEXT(" 0: Frametime (but can create feedback loop when GPU bound and VSync);")
TEXT(" 1: Threads time (default);"),
ECVF_RenderThreadSafe | ECVF_Default);
static TAutoConsoleVariable<float> CVarDynamicFrameTimeRoundUpToVsync(
#Associated Variable and Callsites
This variable is associated with another variable named CVarDynamicFrameTimeTrack
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DynamicResolution.cpp:56
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe | ECVF_Default);
static TAutoConsoleVariable<int32> CVarDynamicFrameTimeTrack(
TEXT("r.DynamicRes.DynamicFrameTime.Track"), 1,
TEXT("What to track to control the budget\n")
TEXT(" 0: Frametime (but can create feedback loop when GPU bound and VSync);")
TEXT(" 1: Threads time (default);"),
ECVF_RenderThreadSafe | ECVF_Default);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DynamicResolution.cpp:286
Scope (from outer to inner):
file
function void FDynamicResolutionHeuristicProxy::RefreshCurrentFrameResolutionFraction_RenderThread
Source code excerpt:
check(VSyncCVar);
const int32 FrameTimeTrack = CVarDynamicFrameTimeTrack.GetValueOnRenderThread();
// Find out the frame time that should be used.
TArray<float, TInlineAllocator<16>> SortedFrameTime;
SortedFrameTime.Reserve(History.Num());
for (int32 BrowsingFrameId = 0; BrowsingFrameId < History.Num(); BrowsingFrameId++)
{