r.RenderTargetPoolMin

r.RenderTargetPoolMin

#Overview

name: r.RenderTargetPoolMin

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

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.RenderTargetPoolMin is to set a minimum size for the render target pool in megabytes. It acts as a threshold below which no deallocation of render targets occurs.

This setting variable is primarily used by the rendering system in Unreal Engine 5. Based on the callsites, it’s utilized in the RenderCore module, specifically within the render target pool management system.

The value of this variable is set through the console variable system. It’s defined as a TAutoConsoleVariable in the ConsoleManager.cpp file with a default value of 400 MB.

The r.RenderTargetPoolMin variable interacts with the render target pool allocation system. It’s used in the FRenderTargetPool::TickPoolElements function to determine the minimum pool size before deallocation occurs.

Developers should be aware that this variable affects memory management for render targets. Setting it too high might prevent necessary deallocations and lead to higher memory usage, while setting it too low might cause frequent allocations and deallocations, potentially impacting performance.

Best practices when using this variable include:

  1. Adjusting it based on the specific needs of your project and target hardware.
  2. Monitoring memory usage and performance to find the optimal value.
  3. Considering the trade-off between memory usage and potential performance impact from frequent allocations/deallocations.
  4. Using it in conjunction with other render target pool management settings for a comprehensive optimization strategy.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseScalability.ini:396, section: [PostProcessQuality@0]

Location: <Workspace>/Engine/Config/BaseScalability.ini:416, section: [PostProcessQuality@1]

Location: <Workspace>/Engine/Config/BaseScalability.ini:449, section: [PostProcessQuality@2]

Location: <Workspace>/Engine/Config/BaseScalability.ini:484, section: [PostProcessQuality@3]

Location: <Workspace>/Engine/Config/BaseScalability.ini:522, section: [PostProcessQuality@Cine]

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

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

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

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

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

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

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

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

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

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/HAL/ConsoleManager.cpp:3822

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarRenderTargetPoolMin(
	TEXT("r.RenderTargetPoolMin"),
	400,
	TEXT("If the render target pool size (in MB) is below this number there is no deallocation of rendertargets"
		 "Default is 200 MB."),
	ECVF_Scalability | ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarIdleWhenNotForeground(

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderTargetPool.cpp:271

Scope (from outer to inner):

file
function     void FRenderTargetPool::TickPoolElements

Source code excerpt:

	uint32 MinimumPoolSizeInKB;
	{
		static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.RenderTargetPoolMin"));

		MinimumPoolSizeInKB = FMath::Clamp(CVar->GetValueOnRenderThread(), 0, 2000) * 1024;
	}

	CompactPool();

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Public/RenderTargetPool.h:165

Scope (from outer to inner):

file
class        class FRenderTargetPool : public FRenderResource

Source code excerpt:

	TArray< TRefCountPtr<FPooledRenderTarget> > DeferredDeleteArray;

	// redundant, can always be computed with GetStats(), to debug "out of memory" situations and used for r.RenderTargetPoolMin
	uint32 AllocationLevelInKB = 0;

	// to avoid log spam
	bool bCurrentlyOverBudget = false;

	// could be done on the fly but that makes the RenderTargetPoolEvents harder to read