r.Streaming.SyncStatesWhenBlocking
r.Streaming.SyncStatesWhenBlocking
#Overview
name: r.Streaming.SyncStatesWhenBlocking
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If true, SyncStates will be called to fully update async states before flushing outstanding streaming requests. Used by Movie Render Queue to ensure all streaming requests are handled each frame to avoid pop-in.
It is referenced in 8
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Streaming.SyncStatesWhenBlocking is to control the synchronization of streaming states before flushing outstanding streaming requests. This setting is primarily used in the rendering and streaming systems of Unreal Engine.
This variable is mainly relied upon by the Unreal Engine’s streaming subsystem, particularly the texture streaming manager. It’s also utilized by the Movie Render Pipeline module for high-quality rendering output.
The value of this variable is set through a console variable (CVar) system. It can be set programmatically or through console commands. By default, it’s set to 0 (false).
The associated variable CVarSyncStatesWhenBlocking interacts directly with r.Streaming.SyncStatesWhenBlocking. They share the same value and purpose.
Developers must be aware that enabling this variable (setting it to 1) can impact performance, as it forces a synchronization of streaming states before flushing requests. This is particularly important in the context of the Movie Render Queue, where it’s used to ensure all streaming requests are handled each frame to avoid pop-in effects.
Best practices when using this variable include:
- Only enable it when necessary, such as during high-quality rendering for cinematics or movie output.
- Be aware of the performance implications when enabled.
- Use it in conjunction with other streaming and rendering settings for optimal results.
Regarding the associated variable CVarSyncStatesWhenBlocking:
The purpose of CVarSyncStatesWhenBlocking is identical to r.Streaming.SyncStatesWhenBlocking. It’s the actual console variable implementation that controls the behavior.
This variable is used directly in the FRenderAssetStreamingManager::BlockTillAllRequestsFinished function to determine whether to call SyncStates before waiting for outstanding work to complete.
The value is set and accessed through the CVar system, typically using CVarSyncStatesWhenBlocking.GetValueOnGameThread().
Developers should treat CVarSyncStatesWhenBlocking as the underlying implementation of the r.Streaming.SyncStatesWhenBlocking setting. When modifying or checking this setting programmatically, they should use the CVarSyncStatesWhenBlocking variable.
Best practices for CVarSyncStatesWhenBlocking align with those of r.Streaming.SyncStatesWhenBlocking, as they are essentially the same setting.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/StreamingManagerTexture.cpp:71
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarSyncStatesWhenBlocking(
TEXT("r.Streaming.SyncStatesWhenBlocking"),
0,
TEXT("If true, SyncStates will be called to fully update async states before flushing outstanding streaming requests. Used by Movie Render Queue to ensure all streaming requests are handled each frame to avoid pop-in."),
ECVF_Default);
// TODO: Remove once efficacy has been verified
static TAutoConsoleVariable<int32> CVarFlushDeferredMipLevelChangeCallbacksBeforeGC(
#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Private/Graph/Nodes/MovieGraphGlobalGameOverrides.cpp:65
Scope (from outer to inner):
file
function void UMovieGraphGlobalGameOverridesNode::BuildNewProcessCommandLineArgsImpl
Source code excerpt:
if (bFlushStreamingManagers)
{
InOutDeviceProfileCvars.Add(TEXT("r.Streaming.SyncStatesWhenBlocking=1"));
}
// Like the extra cvars applied in ApplySettings(), the below are applied to allow MRQ to function correctly.
#if WITH_EDITOR
{
#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Private/Graph/Nodes/MovieGraphGlobalGameOverrides.cpp:134
Scope (from outer to inner):
file
function void UMovieGraphGlobalGameOverridesNode::ApplySettings
Source code excerpt:
if (bFlushStreamingManagers)
{
MOVIEPIPELINE_STORE_AND_OVERRIDE_CVAR_INT(PreviousStreamingManagerSyncState, TEXT("r.Streaming.SyncStatesWhenBlocking"), 1, bOverrideValues);
}
// Set cvars that allow MRQ to run correctly. These are not exposed as properties on the node, but the chance of a
// user needing to customize these (or be aware of them) is very low.
{
#if WITH_EDITOR
#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Private/MoviePipelineGameOverrideSetting.cpp:100
Scope (from outer to inner):
file
function void UMoviePipelineGameOverrideSetting::ApplyCVarSettings
Source code excerpt:
if (bFlushStreamingManagers)
{
MOVIEPIPELINE_STORE_AND_OVERRIDE_CVAR_INT(PreviousStreamingManagerSyncState, TEXT("r.Streaming.SyncStatesWhenBlocking"), 1, bOverrideValues);
}
#if WITH_EDITOR
// To make sure the GeometryCache streamer doesn't skip frames and doesn't pop up notification during rendering
MOVIEPIPELINE_STORE_AND_OVERRIDE_CVAR_INT_IF_EXIST(PreviousGeoCacheStreamerBlockTillFinish, TEXT("GeometryCache.Streamer.BlockTillFinishStreaming"), 1, bOverrideValues);
MOVIEPIPELINE_STORE_AND_OVERRIDE_CVAR_INT_IF_EXIST(PreviousGeoCacheStreamerShowNotification, TEXT("GeometryCache.Streamer.ShowNotification"), 0, bOverrideValues);
#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Private/MoviePipelineGameOverrideSetting.cpp:222
Scope (from outer to inner):
file
function void UMoviePipelineGameOverrideSetting::BuildNewProcessCommandLineArgsImpl
Source code excerpt:
if (bFlushStreamingManagers)
{
InOutDeviceProfileCvars.Add(TEXT("r.Streaming.SyncStatesWhenBlocking=1"));
}
#if WITH_EDITOR
{
InOutDeviceProfileCvars.Add(TEXT("GeometryCache.Streamer.BlockTillFinishStreaming=1"));
InOutDeviceProfileCvars.Add(TEXT("GeometryCache.Streamer.ShowNotification=0"));
#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Public/Graph/Nodes/MovieGraphGlobalGameOverrides.h:176
Scope (from outer to inner):
file
function class MOVIERENDERPIPELINECORE_API UMovieGraphGlobalGameOverridesNode : public UMovieGraphSettingNode { GENERATED_BODY
Source code excerpt:
*
* Configures the following cvars:
* - r.Streaming.SyncStatesWhenBlocking
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Rendering", meta = (EditCondition = "bOverride_bFlushStreamingManagers"))
bool bFlushStreamingManagers;
/** The virtual texture feedback resolution factor. A lower factor will increase virtual texture feedback resolution. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Rendering", meta = (EditCondition = "bOverride_VirtualTextureFeedbackFactor"))
int32 VirtualTextureFeedbackFactor;
private:
Scalability::FQualityLevels PreviousQualityLevels;
int32 PreviousTextureStreaming;
int32 PreviousForceLOD;
int32 PreviousSkeletalMeshBias;
int32 PreviousParticleLODBias;
int32 PreviousFoliageDitheredLOD;
int32 PreviousFoliageForceLOD;
int32 PreviousStreamingManagerSyncState;
#Associated Variable and Callsites
This variable is associated with another variable named CVarSyncStatesWhenBlocking
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/StreamingManagerTexture.cpp:70
Scope: file
Source code excerpt:
ECVF_Default);
static TAutoConsoleVariable<int32> CVarSyncStatesWhenBlocking(
TEXT("r.Streaming.SyncStatesWhenBlocking"),
0,
TEXT("If true, SyncStates will be called to fully update async states before flushing outstanding streaming requests. Used by Movie Render Queue to ensure all streaming requests are handled each frame to avoid pop-in."),
ECVF_Default);
// TODO: Remove once efficacy has been verified
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/StreamingManagerTexture.cpp:1933
Scope (from outer to inner):
file
function int32 FRenderAssetStreamingManager::BlockTillAllRequestsFinished
Source code excerpt:
{
// Optionally synchronize the states of async work before we wait for outstanding work to be completed.
if (CVarSyncStatesWhenBlocking.GetValueOnGameThread() != 0)
{
SyncStates(true);
}
int32 NumOfInFlights = 0;