r.TSR.Resurrection.PersistentFrameCount
r.TSR.Resurrection.PersistentFrameCount
#Overview
name: r.TSR.Resurrection.PersistentFrameCount
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Configures the number of persistent frame to record in history for futur history resurrection. This will increase the memory footprint of the entire TSR history. Must be an even number greater or equal to 2. (default=2)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.TSR.Resurrection.PersistentFrameCount is to configure the number of persistent frames to record in history for future history resurrection in the Temporal Super Resolution (TSR) system. This setting is part of Unreal Engine 5’s rendering system, specifically the Temporal Super Resolution feature.
This setting variable is primarily used in the Renderer module, particularly within the Temporal Super Resolution subsystem. It is referenced in the PostProcess/TemporalSuperResolution.cpp file, which is responsible for implementing the TSR feature.
The value of this variable is set using a TAutoConsoleVariable, which means it can be adjusted at runtime through console commands or configuration files. The default value is set to 2.
This variable interacts with another variable named CVarTSRResurrectionPersistentFrameInterval. Together, they control the behavior of the TSR history resurrection feature.
Developers must be aware of several important aspects when using this variable:
- The value must be an even number greater than or equal to 2.
- Increasing this value will increase the memory footprint of the entire TSR history.
- The actual number of frames stored is calculated by dividing this value by 2 and rounding up, then multiplying by 2 again.
Best practices when using this variable include:
- Carefully consider the performance implications of increasing this value, as it directly affects memory usage.
- Ensure that the value is always set to an even number to maintain proper functionality.
- Monitor the impact on visual quality and performance when adjusting this value in conjunction with other TSR settings.
Regarding the associated variable CVarTSRResurrectionPersistentFrameCount:
This variable is actually the internal representation of the r.TSR.Resurrection.PersistentFrameCount console variable. It is used in the same way and for the same purpose as described above. The main difference is that this is the C++ variable that directly holds the value set by the console command.
When working with this variable in C++ code, developers should:
- Use GetValueOnRenderThread() to access its current value safely.
- Be aware that this variable is used in calculations for determining the FrameStorageCount in the TSR system.
- Understand that changes to this variable will affect the behavior of the TSR history resurrection feature and should be tested thoroughly for performance and visual quality impacts.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/TemporalSuperResolution.cpp:238
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
TAutoConsoleVariable<int32> CVarTSRResurrectionPersistentFrameCount(
TEXT("r.TSR.Resurrection.PersistentFrameCount"), 2,
TEXT("Configures the number of persistent frame to record in history for futur history resurrection. ")
TEXT("This will increase the memory footprint of the entire TSR history. ")
TEXT("Must be an even number greater or equal to 2. (default=2)"),
ECVF_RenderThreadSafe);
TAutoConsoleVariable<int32> CVarTSRResurrectionPersistentFrameInterval(
#Associated Variable and Callsites
This variable is associated with another variable named CVarTSRResurrectionPersistentFrameCount
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/TemporalSuperResolution.cpp:237
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
ECVF_Scalability | ECVF_RenderThreadSafe);
TAutoConsoleVariable<int32> CVarTSRResurrectionPersistentFrameCount(
TEXT("r.TSR.Resurrection.PersistentFrameCount"), 2,
TEXT("Configures the number of persistent frame to record in history for futur history resurrection. ")
TEXT("This will increase the memory footprint of the entire TSR history. ")
TEXT("Must be an even number greater or equal to 2. (default=2)"),
ECVF_RenderThreadSafe);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/TemporalSuperResolution.cpp:1261
Scope (from outer to inner):
file
function FDefaultTemporalUpscaler::FOutputs AddTemporalSuperResolutionPasses
Source code excerpt:
{
HistorySliceSequence.FrameStorageCount = FMath::Clamp(
FTSRHistorySliceSequence::kTransientSliceCount + FMath::DivideAndRoundUp(CVarTSRResurrectionPersistentFrameCount.GetValueOnRenderThread(), 2) * 2,
4,
GMaxTextureArrayLayers);
HistorySliceSequence.FrameStoragePeriod = FMath::Clamp(CVarTSRResurrectionPersistentFrameInterval.GetValueOnRenderThread() | 0x1, 1, 1024);
}
check(HistorySliceSequence.Check());