r.Streaming.MaxTempMemoryAllowed

r.Streaming.MaxTempMemoryAllowed

#Overview

name: r.Streaming.MaxTempMemoryAllowed

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.Streaming.MaxTempMemoryAllowed is to control the maximum temporary memory allowed for texture streaming operations in Unreal Engine 5. It specifically limits the amount of memory used when streaming in or out texture mips.

This setting variable is primarily used by the texture streaming system, which is part of the rendering subsystem in Unreal Engine. It’s directly related to memory management during texture streaming operations.

The value of this variable is set through a console variable (CVar) named CVarStreamingMaxTempMemoryAllowed. It’s initialized with a default value of 50, which presumably represents 50 MB of memory.

The associated variable CVarStreamingMaxTempMemoryAllowed interacts directly with r.Streaming.MaxTempMemoryAllowed. They share the same value and purpose.

Developers must be aware that this variable affects the performance and memory usage of texture streaming. Setting it too low might limit streaming speed, while setting it too high could lead to excessive memory usage.

Best practices when using this variable include:

  1. Adjusting it based on the target hardware capabilities.
  2. Monitoring its impact on streaming performance and overall memory usage.
  3. Balancing it with other streaming-related settings for optimal performance.

Regarding the associated variable CVarStreamingMaxTempMemoryAllowed:

The purpose of CVarStreamingMaxTempMemoryAllowed is to provide programmatic access to the r.Streaming.MaxTempMemoryAllowed setting within the engine’s C++ code.

This variable is used in the texture streaming subsystem of Unreal Engine. It’s referenced in the FRenderAssetStreamingSettings::Update() function, which suggests it’s part of the configuration for render asset streaming.

The value of this variable is set when the r.Streaming.MaxTempMemoryAllowed console command is used, and it can be accessed in code using the GetValueOnAnyThread() method.

CVarStreamingMaxTempMemoryAllowed interacts directly with other streaming-related variables in the FRenderAssetStreamingSettings struct, such as MaxEffectiveScreenSize and GlobalMipBias.

Developers should be aware that changes to this variable will affect the engine’s texture streaming behavior at runtime.

Best practices include using this variable in conjunction with other streaming settings for fine-tuning performance, and potentially exposing it through game settings if runtime adjustment is needed.

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

Scope: file

Source code excerpt:


TAutoConsoleVariable<int32> CVarStreamingMaxTempMemoryAllowed(
	TEXT("r.Streaming.MaxTempMemoryAllowed"),
	50,
	TEXT("Maximum temporary memory used when streaming in or out texture mips.\n")
	TEXT("This memory contains mips used for the new updated texture.\n")
	TEXT("The value must be high enough to not be a limiting streaming speed factor.\n"),
	ECVF_Default);

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.cpp:118

Scope: file

Source code excerpt:

	ECVF_Scalability | ECVF_ExcludeFromPreview);

TAutoConsoleVariable<int32> CVarStreamingMaxTempMemoryAllowed(
	TEXT("r.Streaming.MaxTempMemoryAllowed"),
	50,
	TEXT("Maximum temporary memory used when streaming in or out texture mips.\n")
	TEXT("This memory contains mips used for the new updated texture.\n")
	TEXT("The value must be high enough to not be a limiting streaming speed factor.\n"),
	ECVF_Default);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/TextureStreamingHelpers.cpp:308

Scope (from outer to inner):

file
function     void FRenderAssetStreamingSettings::Update

Source code excerpt:

{
	MaxEffectiveScreenSize = CVarStreamingScreenSizeEffectiveMax.GetValueOnAnyThread();
	MaxTempMemoryAllowed = CVarStreamingMaxTempMemoryAllowed.GetValueOnAnyThread();
	HLODStrategy = CVarStreamingHLODStrategy.GetValueOnAnyThread();
	GlobalMipBias = !GIsEditor ? FMath::FloorToInt(FMath::Max<float>(0.f, CVarStreamingMipBias.GetValueOnAnyThread())) : 0;
	PoolSize = CVarStreamingPoolSize.GetValueOnAnyThread();
	MeshPoolSize = CVarStreamingPoolSizeForMeshes.GetValueOnAnyThread();
	bUsePerTextureBias = CVarStreamingUsePerTextureBias.GetValueOnAnyThread() != 0;
	bUseNewMetrics = CVarStreamingUseNewMetrics.GetValueOnAnyThread() != 0;