r.Streaming.FramesForFullUpdate
r.Streaming.FramesForFullUpdate
#Overview
name: r.Streaming.FramesForFullUpdate
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Texture streaming is time sliced per frame. This values gives the number of frames to visit all textures.
It is referenced in 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Streaming.FramesForFullUpdate is to control the time-slicing of texture streaming updates in Unreal Engine 5. It determines the number of frames over which the engine will visit and update all textures in the streaming system.
This setting variable is primarily used by the texture streaming system, which is part of the rendering subsystem in Unreal Engine. Based on the callsites, it’s utilized in the following areas:
- The Engine module, specifically in the texture streaming helpers.
- The MovieRenderPipeline plugin, for overriding streaming settings during movie rendering.
- The Renderer module, for displaying debug information about the streaming system.
The value of this variable is set through the console variable system. It’s initialized with a default value of 5 frames, but can be changed at runtime using console commands or through code.
The associated variable CVarFramesForFullUpdate directly interacts with r.Streaming.FramesForFullUpdate. They share the same value and are used interchangeably in different parts of the engine.
Developers should be aware of the following when using this variable:
- Setting it to 0 may impact performance, as it would attempt to update all textures every frame.
- Higher values will spread the texture streaming workload over more frames, potentially reducing frame-to-frame variation but increasing the time for all textures to be fully updated.
- This variable is overridden in certain scenarios, such as during movie rendering when using the FullyLoad texture streaming method.
Best practices for using this variable include:
- Keep the default value (5) unless there’s a specific need to change it.
- When adjusting, balance between responsiveness of texture streaming and maintaining consistent frame rates.
- For high-performance scenarios, consider increasing the value to spread the workload over more frames.
- For scenarios requiring quick texture updates, decrease the value, but be cautious of potential performance impacts.
Regarding the associated variable CVarFramesForFullUpdate:
The purpose of CVarFramesForFullUpdate is to provide a programmatic interface to the r.Streaming.FramesForFullUpdate setting. It’s used internally by the engine to access and modify the value of the setting.
This variable is primarily used in the Engine module, specifically in the texture streaming system. It’s defined and initialized in the texture streaming helpers, and its value is used to update the FRenderAssetStreamingSettings structure.
The value of CVarFramesForFullUpdate is set when the r.Streaming.FramesForFullUpdate console variable is modified, either through console commands or programmatically.
Developers should be aware that modifying CVarFramesForFullUpdate directly will affect the behavior of the texture streaming system in the same way as modifying r.Streaming.FramesForFullUpdate.
Best practices for using CVarFramesForFullUpdate include:
- Use it for reading the current value of the setting in C++ code.
- If you need to modify the setting programmatically, use the console variable system rather than modifying CVarFramesForFullUpdate directly.
- Be aware of its usage in performance-critical code, such as the FRenderAssetStreamingSettings::Update function.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.cpp:263
Scope: file
Source code excerpt:
ENGINE_API TAutoConsoleVariable<int32> CVarFramesForFullUpdate(
TEXT("r.Streaming.FramesForFullUpdate"),
5,
TEXT("Texture streaming is time sliced per frame. This values gives the number of frames to visit all textures."));
TAutoConsoleVariable<int32> CVarStreamingLowResHandlingMode(
TEXT("r.Streaming.LowResHandlingMode"),
(int32)FRenderAssetStreamingSettings::LRHM_DoNothing,
#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Private/MoviePipelineGameOverrideSetting.cpp:51
Scope (from outer to inner):
file
function void UMoviePipelineGameOverrideSetting::ApplyCVarSettings
Source code excerpt:
{
case EMoviePipelineTextureStreamingMethod::FullyLoad:
MOVIEPIPELINE_STORE_AND_OVERRIDE_CVAR_INT(PreviousFramesForFullUpdate, TEXT("r.Streaming.FramesForFullUpdate"), 0, bOverrideValues);
MOVIEPIPELINE_STORE_AND_OVERRIDE_CVAR_INT(PreviousFullyLoadUsedTextures, TEXT("r.Streaming.FullyLoadUsedTextures"), 1, bOverrideValues);
break;
case EMoviePipelineTextureStreamingMethod::Disabled:
MOVIEPIPELINE_STORE_AND_OVERRIDE_CVAR_INT(PreviousTextureStreaming, TEXT("r.TextureStreaming"), 0, bOverrideValues);
break;
default:
#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Private/MoviePipelineGameOverrideSetting.cpp:177
Scope (from outer to inner):
file
function void UMoviePipelineGameOverrideSetting::BuildNewProcessCommandLineArgsImpl
Source code excerpt:
{
case EMoviePipelineTextureStreamingMethod::FullyLoad:
InOutDeviceProfileCvars.Add(TEXT("r.Streaming.FramesForFullUpdate=0"));
InOutDeviceProfileCvars.Add(TEXT("r.Streaming.FullyLoadUsedTextures=1"));
break;
case EMoviePipelineTextureStreamingMethod::Disabled:
InOutDeviceProfileCvars.Add(TEXT("r.TextureStreaming=0"));
break;
default:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:5628
Scope (from outer to inner):
file
function static void DisplayInternals
lambda-function
Source code excerpt:
}
{
static auto* Var = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Streaming.FramesForFullUpdate"));
int32 Value = Var->GetValueOnRenderThread();
bool bHighlight = Value != 0;
CANVAS_LINE(bHighlight, TEXT(" r.Streaming.FramesForFullUpdate: %u%s"), Value, bHighlight ? TEXT(" (should be 0)") : TEXT(""));
}
if(State)
{
CANVAS_HEADER(TEXT("State:"))
CANVAS_LINE(false, TEXT(" TemporalAASample: %u"), State->GetCurrentTemporalAASampleIndex())
CANVAS_LINE(false, TEXT(" FrameIndexMod8: %u"), State->GetFrameIndex(8))
CANVAS_LINE(false, TEXT(" LODTransition: %.2f"), State->GetTemporalLODTransition())
}
CANVAS_HEADER(TEXT("Family:"))
CANVAS_LINE(false, TEXT(" Time (Real/World/DeltaWorld): %.2f/%.2f/%.2f"), Family->Time.GetRealTimeSeconds(), Family->Time.GetWorldTimeSeconds(), Family->Time.GetDeltaWorldTimeSeconds())
CANVAS_LINE(false, TEXT(" FrameNumber: %u"), Family->FrameNumber)
CANVAS_LINE(false, TEXT(" ExposureSettings: %s"), *Family->ExposureSettings.ToString())
CANVAS_HEADER(TEXT("View:"))
CANVAS_LINE(false, TEXT(" TemporalJitter: %.2f/%.2f"), ViewInfo.TemporalJitterPixels.X, ViewInfo.TemporalJitterPixels.Y)
CANVAS_LINE(false, TEXT(" ViewProjectionMatrix Hash: %x"), InView.ViewMatrices.GetViewProjectionMatrix().ComputeHash())
CANVAS_LINE(false, TEXT(" ViewLocation: %s"), *InView.ViewLocation.ToString())
CANVAS_LINE(false, TEXT(" ViewRotation: %s"), *InView.ViewRotation.ToString())
CANVAS_LINE(false, TEXT(" ViewRect: %s"), *ViewInfo.ViewRect.ToString())
CANVAS_LINE(false, TEXT(" DynMeshElements/TranslPrim: %d/%d"), ViewInfo.DynamicMeshElements.Num(), ViewInfo.TranslucentPrimCount.NumPrims())
#undef CANVAS_LINE
#undef CANVAS_HEADER
});
}
#endif
}
TSharedRef<ISceneViewExtension, ESPMode::ThreadSafe> GetRendererViewExtension()
{
class FRendererViewExtension : public ISceneViewExtension
{
public:
virtual void SetupViewFamily(FSceneViewFamily& InViewFamily) {}
virtual void SetupView(FSceneViewFamily& InViewFamily, FSceneView& InView) {}
virtual void BeginRenderViewFamily(FSceneViewFamily& InViewFamily) {}
virtual void PreRenderViewFamily_RenderThread(FRDGBuilder& GraphBuilder, FSceneViewFamily& InViewFamily) {}
virtual void PreRenderView_RenderThread(FRDGBuilder& GraphBuilder, FSceneView& InView) {}
virtual int32 GetPriority() const { return 0; }
virtual void PostRenderView_RenderThread(FRDGBuilder& GraphBuilder, FSceneView& InView)
{
FViewInfo& View = static_cast<FViewInfo&>(InView);
DisplayInternals(GraphBuilder, View);
}
};
TSharedRef<FRendererViewExtension, ESPMode::ThreadSafe> ref(new FRendererViewExtension);
return StaticCastSharedRef<ISceneViewExtension>(ref);
}
#endif // !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
void FSceneRenderer::SetStereoViewport(FRHICommandList& RHICmdList, const FViewInfo& View, float ViewportScale)
{
if (View.IsInstancedStereoPass())
{
if (View.bIsMultiViewportEnabled)
{
const FViewInfo& LeftView = View;
const uint32 LeftMinX = LeftView.ViewRect.Min.X * ViewportScale;
const uint32 LeftMaxX = LeftView.ViewRect.Max.X * ViewportScale;
const uint32 LeftMaxY = LeftView.ViewRect.Max.Y * ViewportScale;
const FViewInfo& RightView = static_cast<const FViewInfo&>(*View.GetInstancedView());
const uint32 RightMinX = RightView.ViewRect.Min.X * ViewportScale;
const uint32 RightMaxX = RightView.ViewRect.Max.X * ViewportScale;
const uint32 RightMaxY = RightView.ViewRect.Max.Y * ViewportScale;
RHICmdList.SetStereoViewport(LeftMinX, RightMinX, 0, 0, 0.0f, LeftMaxX, RightMaxX, LeftMaxY, RightMaxY, 1.0f);
}
else
{
RHICmdList.SetViewport(View.ViewRectWithSecondaryViews.Min.X * ViewportScale, View.ViewRectWithSecondaryViews.Min.Y * ViewportScale, 0.0f, View.ViewRectWithSecondaryViews.Max.X * ViewportScale, View.ViewRectWithSecondaryViews.Max.Y * ViewportScale, 1.0f);
}
}
else
{
RHICmdList.SetViewport(View.ViewRect.Min.X * ViewportScale, View.ViewRect.Min.Y * ViewportScale, 0.0f, View.ViewRect.Max.X * ViewportScale, View.ViewRect.Max.Y * ViewportScale, 1.0f);
}
}
/**
* Saves a previously rendered scene color target
*/
class FDummySceneColorResolveBuffer : public FVertexBuffer
{
public:
virtual void InitRHI(FRHICommandListBase& RHICmdList) override
{
const int32 NumDummyVerts = 3;
const uint32 Size = sizeof(FVector4f) * NumDummyVerts;
#Associated Variable and Callsites
This variable is associated with another variable named CVarFramesForFullUpdate
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/TextureStreamingTypes.h:329
Scope: file
Source code excerpt:
extern ENGINE_API TAutoConsoleVariable<int32> CVarStreamingUseNewMetrics;
extern ENGINE_API TAutoConsoleVariable<int32> CVarFramesForFullUpdate;
/** Reset the history of the value returned by GetAverageRequiredTexturePoolSize() */
ENGINE_API void ResetAverageRequiredTexturePoolSize();
/**
* Returns the average value of the required texture pool "r.streaming.PoolSize" since engine start or since the last ResetAverageRequiredTexturePoolSize().
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.cpp:262
Scope: file
Source code excerpt:
ECVF_Default);
ENGINE_API TAutoConsoleVariable<int32> CVarFramesForFullUpdate(
TEXT("r.Streaming.FramesForFullUpdate"),
5,
TEXT("Texture streaming is time sliced per frame. This values gives the number of frames to visit all textures."));
TAutoConsoleVariable<int32> CVarStreamingLowResHandlingMode(
TEXT("r.Streaming.LowResHandlingMode"),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.cpp:359
Scope (from outer to inner):
file
function void FRenderAssetStreamingSettings::Update
Source code excerpt:
{
bStressTest = false;
FramesForFullUpdate = FMath::Max<int32>(CVarFramesForFullUpdate.GetValueOnAnyThread(), 0);
DropMips = CVarStreamingDropMips.GetValueOnAnyThread();
ExtraIOLatency = 0;
}
}
/** the float table {-1.0f,1.0f} **/