r.GPUScene.UseGrowOnlyAllocationPolicy
r.GPUScene.UseGrowOnlyAllocationPolicy
#Overview
name: r.GPUScene.UseGrowOnlyAllocationPolicy
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Deprecated 5.3. If set to 1 the allocators used for GPU-scene instances and similar will use a grow-only allocation policy to mimic the behavior in 5.2 and earlier.\n Disabled by default, which means that the buffers can shrink as well as grow.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.GPUScene.UseGrowOnlyAllocationPolicy is to control the allocation policy for GPU scene instances and similar buffers in Unreal Engine’s rendering system. It is a deprecated setting as of Unreal Engine 5.3, but it still exists for backward compatibility.
This setting variable is primarily used by the Renderer module of Unreal Engine, specifically in the GPU scene management subsystem. It affects how memory is allocated and managed for GPU scene instances.
The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable with a default value of 0.
The associated variable CVarGPUSceneUseGrowOnlyAllocationPolicy directly interacts with r.GPUScene.UseGrowOnlyAllocationPolicy. They share the same value and purpose.
Developers must be aware that:
- This setting is deprecated as of Unreal Engine 5.3.
- When set to 1, it mimics the behavior of Unreal Engine 5.2 and earlier, using a grow-only allocation policy for GPU scene instances.
- When set to 0 (default), it allows buffers to both grow and shrink as needed.
Best practices when using this variable:
- For new projects or when upgrading to UE 5.3+, it’s recommended to leave this setting at its default value (0) to benefit from the improved memory management.
- Only use this setting if you need to maintain compatibility with behavior from UE 5.2 or earlier.
- Be cautious when changing this setting, as it can impact memory usage and performance.
Regarding the associated variable CVarGPUSceneUseGrowOnlyAllocationPolicy:
- It’s an internal representation of the r.GPUScene.UseGrowOnlyAllocationPolicy console variable.
- It’s used directly in the FGPUScene constructor to initialize various allocators (InstancePayloadDataAllocator, LightmapDataAllocator, InstanceSceneDataAllocator).
- The value is retrieved using GetValueOnAnyThread(), which suggests it can be accessed from multiple threads.
- Developers should not interact with this variable directly, but rather use the r.GPUScene.UseGrowOnlyAllocationPolicy console variable if they need to change the behavior.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GPUScene.cpp:99
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarGPUSceneUseGrowOnlyAllocationPolicy(
TEXT("r.GPUScene.UseGrowOnlyAllocationPolicy"),
0,
TEXT("Deprecated 5.3. If set to 1 the allocators used for GPU-scene instances and similar will use a grow-only allocation policy to mimic the behavior in 5.2 and earlier.\n")
TEXT(" Disabled by default, which means that the buffers can shrink as well as grow."),
ECVF_RenderThreadSafe | ECVF_ReadOnly
);
#Associated Variable and Callsites
This variable is associated with another variable named CVarGPUSceneUseGrowOnlyAllocationPolicy
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GPUScene.cpp:98
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarGPUSceneUseGrowOnlyAllocationPolicy(
TEXT("r.GPUScene.UseGrowOnlyAllocationPolicy"),
0,
TEXT("Deprecated 5.3. If set to 1 the allocators used for GPU-scene instances and similar will use a grow-only allocation policy to mimic the behavior in 5.2 and earlier.\n")
TEXT(" Disabled by default, which means that the buffers can shrink as well as grow."),
ECVF_RenderThreadSafe | ECVF_ReadOnly
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GPUScene.cpp:614
Scope (from outer to inner):
file
function FGPUScene::FGPUScene
Source code excerpt:
: bUpdateAllPrimitives(false)
, InstanceSceneDataSOAStride(0)
, InstancePayloadDataAllocator(CVarGPUSceneUseGrowOnlyAllocationPolicy.GetValueOnAnyThread() != 0)
, LightmapDataAllocator(CVarGPUSceneUseGrowOnlyAllocationPolicy.GetValueOnAnyThread() != 0)
, Scene(InScene)
, InstanceSceneDataAllocator(CVarGPUSceneUseGrowOnlyAllocationPolicy.GetValueOnAnyThread() != 0)
{
#if !UE_BUILD_SHIPPING
ScreenMessageDelegate = FRendererOnScreenNotification::Get().AddLambda([this](TMultiMap<FCoreDelegates::EOnScreenMessageSeverity, FText >& OutMessages)
{
if (InstanceSceneDataSOAStride < MaxInstancesDuringPrevUpdate)
{