r.DynamicRes.DynamicFrameTime.RoundUpToVSyncError
r.DynamicRes.DynamicFrameTime.RoundUpToVSyncError
#Overview
name: r.DynamicRes.DynamicFrameTime.RoundUpToVSyncError
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Error to use to round up the dynamic frame time to vsync boundaries (default=10%).
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.DynamicRes.DynamicFrameTime.RoundUpToVSyncError is to control the error margin used when rounding up the dynamic frame time to VSync boundaries in Unreal Engine’s dynamic resolution system.
This setting variable is primarily used in the rendering system, specifically in the dynamic resolution subsystem. It is implemented in the Engine module, as evident from its location in the DynamicResolution.cpp file.
The value of this variable is set through a console variable (CVar) system, which allows it to be changed at runtime. It’s defined with a default value of 10.0f (10%), but can be modified through console commands or project settings.
This variable interacts closely with its associated variable CVarDynamicFrameTimeRoundUpToVsync, which is used to access the value in the code. They share the same value and purpose.
Developers should be aware that this variable is used when VSync is enabled and the system is CPU-bound. It allows the engine to slightly increase the available GPU time, potentially improving performance in these scenarios.
Best practices for using this variable include:
- Understanding its impact on frame pacing and GPU utilization.
- Adjusting it carefully in conjunction with other dynamic resolution and VSync settings.
- Testing thoroughly across different hardware configurations to ensure optimal performance.
Regarding the associated variable CVarDynamicFrameTimeRoundUpToVsync:
The purpose of CVarDynamicFrameTimeRoundUpToVsync is to provide a programmatic way to access the value of r.DynamicRes.DynamicFrameTime.RoundUpToVSyncError within the engine’s C++ code.
It is used in the same subsystem (dynamic resolution) and module (Engine) as r.DynamicRes.DynamicFrameTime.RoundUpToVSyncError.
The value of this variable is set automatically based on the console variable r.DynamicRes.DynamicFrameTime.RoundUpToVSyncError.
This variable directly interacts with the VSync settings and is used in calculations related to frame timing and GPU utilization.
Developers should be aware that modifying r.DynamicRes.DynamicFrameTime.RoundUpToVSyncError will affect the behavior of code using CVarDynamicFrameTimeRoundUpToVsync.
Best practices include using GetValueOnRenderThread() when accessing this variable to ensure thread-safe operations in render thread contexts.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DynamicResolution.cpp:64
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarDynamicFrameTimeRoundUpToVsync(
TEXT("r.DynamicRes.DynamicFrameTime.RoundUpToVSyncError"), 10.f,
TEXT("Error to use to round up the dynamic frame time to vsync boundaries (default=10%)."),
ECVF_RenderThreadSafe | ECVF_Default);
#endif
#Associated Variable and Callsites
This variable is associated with another variable named CVarDynamicFrameTimeRoundUpToVsync
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DynamicResolution.cpp:63
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe | ECVF_Default);
static TAutoConsoleVariable<float> CVarDynamicFrameTimeRoundUpToVsync(
TEXT("r.DynamicRes.DynamicFrameTime.RoundUpToVSyncError"), 10.f,
TEXT("Error to use to round up the dynamic frame time to vsync boundaries (default=10%)."),
ECVF_RenderThreadSafe | ECVF_Default);
#endif
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DynamicResolution.cpp:324
Scope (from outer to inner):
file
function void FDynamicResolutionHeuristicProxy::RefreshCurrentFrameResolutionFraction_RenderThread
Source code excerpt:
// When CPU bound and vsync is enabled, the GPU may end up underused due to vsync wait, so we can crank up the available GPU time a bit more.
const float RoundUpToVSyncError = CVarDynamicFrameTimeRoundUpToVsync.GetValueOnRenderThread();
if (RoundUpToVSyncError > 0.0f && VSyncCVar->GetInt())
{
const float VSyncFrameTime = 1000.0f / float(FPlatformMisc::GetMaxRefreshRate());
float VSyncRateChangeMultiplier = 1.0f + RoundUpToVSyncError / 100.f;
int32 CurrentVSyncFactor = FMath::CeilToInt(MedianFrameTime / VSyncFrameTime);