r.Streaming.DefragDynamicBounds
r.Streaming.DefragDynamicBounds
#Overview
name: r.Streaming.DefragDynamicBounds
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If non-zero, unused dynamic bounds will be removed from the update loop
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Streaming.DefragDynamicBounds is to control the defragmentation of dynamic bounds in the texture streaming system. This setting variable is part of Unreal Engine’s rendering and streaming subsystem.
The Unreal Engine subsystem that relies on this setting variable is the texture streaming system, specifically the dynamic texture instance management component. This can be inferred from the file names where the variable is referenced: “TextureStreamingHelpers.cpp” and “DynamicTextureInstanceManager.cpp”.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1, meaning the feature is enabled by default. Developers can change this value at runtime using console commands or through configuration files.
The associated variable CVarStreamingDefragDynamicBounds interacts directly with r.Streaming.DefragDynamicBounds. They share the same value and purpose.
Developers must be aware that this variable affects the performance and memory usage of the texture streaming system. When enabled (value > 0), it removes unused dynamic bounds from the update loop, which can potentially improve performance by reducing unnecessary processing.
Best practices when using this variable include:
- Leave it enabled (default value of 1) unless specific performance issues are observed.
- If disabling it, carefully monitor the impact on memory usage and streaming performance.
- Consider adjusting this variable in different scenarios (e.g., development vs. shipping builds) to find the optimal balance between performance and memory usage.
Regarding the associated variable CVarStreamingDefragDynamicBounds:
- Its purpose is the same as r.Streaming.DefragDynamicBounds.
- It’s used directly in the code to check the feature’s state and control the defragmentation logic.
- The value is accessed using the GetValueOnGameThread() method, indicating it’s designed for use in the game thread.
- Developers should be aware that changes to this variable will immediately affect the texture streaming system’s behavior.
- Best practices include using this variable for runtime checks and potentially exposing it as a user-configurable option if fine-tuning of the streaming system is required for different hardware configurations.
#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:230
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarStreamingDefragDynamicBounds(
TEXT("r.Streaming.DefragDynamicBounds"),
1,
TEXT("If non-zero, unused dynamic bounds will be removed from the update loop"),
ECVF_Default);
// Don't split small mips as the overhead of 2 load is significant.
TAutoConsoleVariable<int32> CVarStreamingMinMipForSplitRequest(
#Associated Variable and Callsites
This variable is associated with another variable named CVarStreamingDefragDynamicBounds
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/DynamicTextureInstanceManager.cpp:156
Scope (from outer to inner):
file
function void FDynamicRenderAssetInstanceManager::OnRefreshVisibilityDone
Source code excerpt:
// Move the last valid bound to the first empty place, trying to free the tail.
if (CVarStreamingDefragDynamicBounds.GetValueOnGameThread() > 0)
{
if (FirstFreeBound < LastUsedBound)
{
PendingDefragDstBoundIndex = FirstFreeBound;
PendingDefragSrcBoundIndex = LastUsedBound;
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.cpp:229
Scope: file
Source code excerpt:
ECVF_Default);
TAutoConsoleVariable<int32> CVarStreamingDefragDynamicBounds(
TEXT("r.Streaming.DefragDynamicBounds"),
1,
TEXT("If non-zero, unused dynamic bounds will be removed from the update loop"),
ECVF_Default);
// Don't split small mips as the overhead of 2 load is significant.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.h:64
Scope: file
Source code excerpt:
extern TAutoConsoleVariable<int32> CVarStreamingUseMaterialData;
extern TAutoConsoleVariable<int32> CVarStreamingNumStaticComponentsProcessedPerFrame;
extern TAutoConsoleVariable<int32> CVarStreamingDefragDynamicBounds;
extern TAutoConsoleVariable<float> CVarStreamingMaxTextureUVDensity;
extern TAutoConsoleVariable<int32> CVarStreamingLowResHandlingMode;
struct FRenderAssetStreamingSettings
{
// How to handle assets with too many missing MIPs or LODs