r.TSR.Resurrection.PersistentFrameInterval

r.TSR.Resurrection.PersistentFrameInterval

#Overview

name: r.TSR.Resurrection.PersistentFrameInterval

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.TSR.Resurrection.PersistentFrameInterval is to configure the frequency of persistent frame recording in the history for future history resurrection in Unreal Engine 5’s Temporal Super Resolution (TSR) system.

This setting variable is primarily used in the rendering system, specifically within the Temporal Super Resolution subsystem. It is part of the Renderer module in Unreal Engine 5.

The value of this variable is set through the TAutoConsoleVariable declaration in the TemporalSuperResolution.cpp file. It has a default value of 31 frames.

This variable interacts with the associated variable CVarTSRResurrectionPersistentFrameInterval, which is used to access the value in the C++ code.

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

  1. The value must be an odd number greater than or equal to 1.
  2. It does not affect the memory footprint of the TSR history.
  3. It can be tuned using the VisualizeTSR show flag and setting r.TSR.Visualize=5.

Best practices when using this variable include:

  1. Adjust the value based on the specific needs of your content.
  2. Use the visualization tools mentioned to fine-tune the parameter.
  3. Keep the value within a reasonable range (1 to 1024) to avoid potential performance issues.

Regarding the associated variable CVarTSRResurrectionPersistentFrameInterval:

This variable is used to access the value of r.TSR.Resurrection.PersistentFrameInterval in the C++ code. It is declared as a TAutoConsoleVariable and is used in the FDefaultTemporalUpscaler::FOutputs AddTemporalSuperResolutionPasses function.

The value of CVarTSRResurrectionPersistentFrameInterval is retrieved using the GetValueOnRenderThread() method and is then used to set the FrameStoragePeriod of the HistorySliceSequence. The value is clamped between 1 and 1024, ensuring it stays within a valid range.

Developers should be aware that this variable is accessed on the render thread, which is important for thread safety considerations. When modifying or reading this value, ensure that it’s done in the appropriate context to avoid potential race conditions or other threading issues.

#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:245

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:


TAutoConsoleVariable<int32> CVarTSRResurrectionPersistentFrameInterval(
	TEXT("r.TSR.Resurrection.PersistentFrameInterval"), 31,
	TEXT("Configures in number of frames how often persistent frame should be recorded in history for futur history resurrection. ")
	TEXT("This has no implication on memory footprint of the TSR history. Must be an odd number greater or equal to 1. ")
	TEXT("Uses the VisualizeTSR show flag and r.TSR.Visualize=5 to tune this parameter to your content. ")
	TEXT("(default=31)"),
	ECVF_RenderThreadSafe);

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/TemporalSuperResolution.cpp:244

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:

	ECVF_RenderThreadSafe);

TAutoConsoleVariable<int32> CVarTSRResurrectionPersistentFrameInterval(
	TEXT("r.TSR.Resurrection.PersistentFrameInterval"), 31,
	TEXT("Configures in number of frames how often persistent frame should be recorded in history for futur history resurrection. ")
	TEXT("This has no implication on memory footprint of the TSR history. Must be an odd number greater or equal to 1. ")
	TEXT("Uses the VisualizeTSR show flag and r.TSR.Visualize=5 to tune this parameter to your content. ")
	TEXT("(default=31)"),
	ECVF_RenderThreadSafe);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/TemporalSuperResolution.cpp:1264

Scope (from outer to inner):

file
function     FDefaultTemporalUpscaler::FOutputs AddTemporalSuperResolutionPasses

Source code excerpt:

			4,
			GMaxTextureArrayLayers);
		HistorySliceSequence.FrameStoragePeriod = FMath::Clamp(CVarTSRResurrectionPersistentFrameInterval.GetValueOnRenderThread() | 0x1, 1, 1024);
	}
	check(HistorySliceSequence.Check());

	// Whether to use wave ops optimizations.
	const ERHIFeatureSupport WaveOpsSupport = FTSRShader::SupportsWaveOps(View.GetShaderPlatform());
	const bool bUseWaveOps = (CVarTSRWaveOps.GetValueOnRenderThread() != 0 && GRHISupportsWaveOperations && (WaveOpsSupport == ERHIFeatureSupport::RuntimeDependent || WaveOpsSupport == ERHIFeatureSupport::RuntimeGuaranteed));