r.Streaming.ProcessAddedRenderAssetsAfterAsyncWork
r.Streaming.ProcessAddedRenderAssetsAfterAsyncWork
#Overview
name: r.Streaming.ProcessAddedRenderAssetsAfterAsyncWork
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to call ProcessAddedRenderAssets in subsqequent UpdateResourceStreaming stages after Async work has completed.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Streaming.ProcessAddedRenderAssetsAfterAsyncWork is to control whether the engine should process newly added render assets after asynchronous work has completed during the resource streaming update process.
This setting variable is primarily used in the rendering system, specifically in the texture streaming subsystem of Unreal Engine. It is referenced in the StreamingManagerTexture.cpp file, which is part of the Engine module.
The value of this variable is set through a console variable (CVar) named CVarProcessAddedRenderAssetsAfterAsyncWork. It is initialized with a default value of 1, meaning the feature is enabled by default.
The associated variable CVarProcessAddedRenderAssetsAfterAsyncWork directly interacts with r.Streaming.ProcessAddedRenderAssetsAfterAsyncWork. They share the same value and purpose.
Developers must be aware that this variable affects the timing of processing newly added render assets. When enabled, it allows the engine to process these assets after asynchronous work has completed, which may impact performance and resource management.
Best practices when using this variable include:
- Monitor performance impacts when enabling or disabling this feature.
- Consider disabling it if you notice any adverse effects on streaming performance.
- Use it in conjunction with profiling tools to optimize render asset streaming in your project.
Regarding the associated variable CVarProcessAddedRenderAssetsAfterAsyncWork:
This is an internal console variable that directly controls the behavior specified by r.Streaming.ProcessAddedRenderAssetsAfterAsyncWork. It is used within the FRenderAssetStreamingManager::UpdateResourceStreaming function to determine whether to call ProcessAddedRenderAssets() after asynchronous work has completed.
Developers should note that this variable is marked with a TODO comment, indicating that it may be temporary and subject to removal once the related functionality has been proven safe in production. When working with this variable, it’s important to keep in mind that its behavior or existence might change in future engine versions.
The best practice for using CVarProcessAddedRenderAssetsAfterAsyncWork is to treat it as an experimental feature and thoroughly test its impact on your specific use case before relying on it in production environments.
#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:85
Scope: file
Source code excerpt:
// TODO: Remove once these calls have been proven safe in production
static TAutoConsoleVariable<int32> CVarProcessAddedRenderAssetsAfterAsyncWork(
TEXT("r.Streaming.ProcessAddedRenderAssetsAfterAsyncWork"),
1,
TEXT("Whether to call ProcessAddedRenderAssets in subsqequent UpdateResourceStreaming stages after Async work has completed."),
ECVF_Default);
bool TrackRenderAsset( const FString& AssetName );
bool UntrackRenderAsset( const FString& AssetName );
#Associated Variable and Callsites
This variable is associated with another variable named CVarProcessAddedRenderAssetsAfterAsyncWork
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/StreamingManagerTexture.cpp:84
Scope: file
Source code excerpt:
// TODO: Remove once these calls have been proven safe in production
static TAutoConsoleVariable<int32> CVarProcessAddedRenderAssetsAfterAsyncWork(
TEXT("r.Streaming.ProcessAddedRenderAssetsAfterAsyncWork"),
1,
TEXT("Whether to call ProcessAddedRenderAssets in subsqequent UpdateResourceStreaming stages after Async work has completed."),
ECVF_Default);
bool TrackRenderAsset( const FString& AssetName );
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/StreamingManagerTexture.cpp:1823
Scope (from outer to inner):
file
function void FRenderAssetStreamingManager::UpdateResourceStreaming
Source code excerpt:
STAT(int32 StartTime = (int32)FPlatformTime::Cycles();)
if (PendingStreamingRenderAssets.Num() > 0 && CVarProcessAddedRenderAssetsAfterAsyncWork.GetValueOnGameThread() && AsyncWork->IsDone())
{
// This will add to the StreamingRenderAssets array potentially reallocating it, but if the Async task has completed, that should be safe.
// As we're only adding items, existing indicies in InflightRenderAssets etc will still be valid.
ProcessAddedRenderAssets();
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/StreamingManagerTexture.cpp:1867
Scope (from outer to inner):
file
function void FRenderAssetStreamingManager::UpdateResourceStreaming
Source code excerpt:
STAT(GatheredStats.StreamRenderAssetsCycles = -(int32)FPlatformTime::Cycles();)
if (PendingStreamingRenderAssets.Num() > 0 && CVarProcessAddedRenderAssetsAfterAsyncWork.GetValueOnGameThread())
{
// This will add to the StreamingRenderAssets array potentially reallocating it, but if the Async task has completed, that should be safe.
// As we're only adding items, existing indicies in InflightRenderAssets etc will still be valid.
ProcessAddedRenderAssets();
}