r.Streaming.AllowFastForceResident

r.Streaming.AllowFastForceResident

#Overview

name: r.Streaming.AllowFastForceResident

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

This variable is created as a Console Variable (cvar).

It is referenced in 7 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Streaming.AllowFastForceResident is to control whether missing mips for fast-force-resident assets can be loaded as soon as possible. This setting is primarily used in the rendering and asset streaming systems of Unreal Engine 5.

This setting variable is relied upon by the Unreal Engine’s streaming subsystem, particularly the RenderAssetStreamingManager. It’s also used in components like SkinnedMeshComponent and StaticMeshComponent, as well as in the MaterialInterface class.

The value of this variable is set through the console variable system. It’s defined as a TAutoConsoleVariable with a default value of 0 (disabled).

The associated variable CVarStreamingAllowFastForceResident interacts directly with r.Streaming.AllowFastForceResident. They share the same value and are used interchangeably in the code.

Developers must be aware that enabling this variable can accelerate the force-resident process for assets, but it may also disturb streaming metric calculations. Additionally, fast-force-resident mips can’t be sacrificed even when overbudget, so it should be used with caution.

Best practices when using this variable include:

  1. Only enable it when necessary, as it can impact streaming metrics.
  2. Monitor performance and memory usage when enabled, as it may lead to higher memory consumption.
  3. Use it in conjunction with other streaming settings to fine-tune the balance between load times and memory usage.

Regarding the associated variable CVarStreamingAllowFastForceResident:

In summary, both r.Streaming.AllowFastForceResident and CVarStreamingAllowFastForceResident are powerful tools for optimizing asset streaming, but they should be used judiciously to avoid negative impacts on overall performance and memory usage.

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/DefaultDeviceProfiles.ini:65, section: [Mobile DeviceProfile]

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarStreamingAllowFastForceResident(
	TEXT("r.Streaming.AllowFastForceResident"),
	0,
	TEXT("Whether it is allowed to load in missing mips for fast-force-resident assets ASAP. ")
	TEXT("Useful to accelerate force-resident process but risks disturbing streaming metric calculation. ")
	TEXT("Fast-force-resident mips can't be sacrificed even when overbudget so use with caution."),
	ECVF_Default);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/SkinnedMeshComponent.cpp:4267

Scope (from outer to inner):

file
function     bool USkinnedMeshComponent::PrestreamMeshLODs

Source code excerpt:

	if (USkinnedAsset* Asset = GetSkinnedAsset())
	{
		static IConsoleVariable* CVarAllowFastForceResident = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Streaming.AllowFastForceResident"));
		Asset->bIgnoreStreamingMipBias = CVarAllowFastForceResident && CVarAllowFastForceResident->GetInt();
		Asset->SetForceMipLevelsToBeResident(Seconds);
		return IStreamingManager::Get().GetRenderAssetStreamingManager().FastForceFullyResident(Asset);
	}
	return false;
}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/StaticMeshComponent.cpp:3135

Scope (from outer to inner):

file
function     bool UStaticMeshComponent::PrestreamMeshLODs

Source code excerpt:

	if (UStaticMesh* Mesh = GetStaticMesh())
	{
		static IConsoleVariable* CVarAllowFastForceResident = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Streaming.AllowFastForceResident"));
		Mesh->bIgnoreStreamingMipBias = CVarAllowFastForceResident && CVarAllowFastForceResident->GetInt();
		Mesh->SetForceMipLevelsToBeResident(Seconds);
		return IStreamingManager::Get().GetRenderAssetStreamingManager().FastForceFullyResident(Mesh);
	}
	return false;
}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Materials/MaterialInterface.cpp:593

Scope (from outer to inner):

file
function     void UMaterialInterface::SetForceMipLevelsToBeResident

Source code excerpt:

			if (bFastResponse && (ForceDuration > 0.f || Texture->bForceMiplevelsToBeResident))
			{
				static IConsoleVariable* CVarAllowFastForceResident = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Streaming.AllowFastForceResident"));

				Texture->bIgnoreStreamingMipBias = CVarAllowFastForceResident && CVarAllowFastForceResident->GetInt();
				if (Texture->IsStreamable())
				{
					IStreamingManager::Get().GetRenderAssetStreamingManager().FastForceFullyResident(Texture);
				}

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/StreamingManagerTexture.cpp:46

Scope: file

Source code excerpt:

	ECVF_Default);

static TAutoConsoleVariable<int32> CVarStreamingAllowFastForceResident(
	TEXT("r.Streaming.AllowFastForceResident"),
	0,
	TEXT("Whether it is allowed to load in missing mips for fast-force-resident assets ASAP. ")
	TEXT("Useful to accelerate force-resident process but risks disturbing streaming metric calculation. ")
	TEXT("Fast-force-resident mips can't be sacrificed even when overbudget so use with caution."),
	ECVF_Default);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/StreamingManagerTexture.cpp:443

Scope (from outer to inner):

file
function     void FRenderAssetStreamingManager::TickFastResponseAssets

Source code excerpt:

void FRenderAssetStreamingManager::TickFastResponseAssets()
{
	if (!CVarStreamingAllowFastForceResident.GetValueOnGameThread())
	{
		return;
	}

	TArray<FStreamingRenderAsset>& StreamingRenderAssets = GetStreamingRenderAssetsAsyncSafe();

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/StreamingManagerTexture.cpp:1260

Scope (from outer to inner):

file
function     bool FRenderAssetStreamingManager::FastForceFullyResident

Source code excerpt:

	TArray<FStreamingRenderAsset>& StreamingRenderAssets = GetStreamingRenderAssetsAsyncSafe();

	if (CVarStreamingAllowFastForceResident.GetValueOnGameThread()
		&& IStreamingManager::Get().IsStreamingEnabled()
		&& !bPauseRenderAssetStreaming
		&& RenderAsset
		&& RenderAsset->bIgnoreStreamingMipBias
		&& (RenderAsset->bForceMiplevelsToBeResident || RenderAsset->ForceMipLevelsToBeResidentTimestamp >= FApp::GetCurrentTime())
		&& StreamingRenderAssets.IsValidIndex(RenderAsset->StreamingIndex)