r.GPUScene.MaxPooledUploadBufferSize

r.GPUScene.MaxPooledUploadBufferSize

#Overview

name: r.GPUScene.MaxPooledUploadBufferSize

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.GPUScene.MaxPooledUploadBufferSize is to control the maximum size of the GPU Scene upload buffer that can be pooled. This setting is part of the rendering system, specifically the GPU Scene management in Unreal Engine 5.

This setting variable is primarily used in the Renderer module of Unreal Engine 5. It’s referenced in the GPUScene.cpp file, which is part of the GPU Scene management system.

The value of this variable is set using a console variable (CVar) system. It’s initialized with a default value of 256000 bytes (approximately 250 KB). This value can be changed at runtime through the console or configuration files.

The associated variable CVarGPUSceneMaxPooledUploadBufferSize directly interacts with r.GPUScene.MaxPooledUploadBufferSize. They share the same value and purpose.

Developers must be aware that this variable affects memory management for GPU Scene updates. It determines the threshold at which upload buffers are released instead of being pooled for reuse. If the size of PrimitiveUploadBuffer or InstanceSceneUploadBuffer exceeds this value, the buffer is released rather than kept in the pool.

Best practices when using this variable include:

  1. Monitoring performance and memory usage to find the optimal value for your specific use case.
  2. Adjusting the value if you notice excessive memory usage or frequent allocation/deallocation of upload buffers.
  3. Being cautious when increasing this value, as it might lead to higher memory usage.

Regarding the associated variable CVarGPUSceneMaxPooledUploadBufferSize:

The purpose of CVarGPUSceneMaxPooledUploadBufferSize is the same as r.GPUScene.MaxPooledUploadBufferSize. It’s the actual console variable that controls the maximum size of the GPU Scene upload buffer to be pooled.

This variable is used in the Renderer module, specifically in the GPU Scene management system.

The value is set when the console variable is initialized, with a default of 256000. It can be changed at runtime through the console or configuration files.

CVarGPUSceneMaxPooledUploadBufferSize directly interacts with r.GPUScene.MaxPooledUploadBufferSize, as they represent the same setting.

Developers should be aware that this is the actual variable used in the code to retrieve the current value of the setting. It’s accessed using GetValueOnRenderThread() method, which ensures thread-safe access to the value.

Best practices include using this variable consistently throughout the codebase when referring to the maximum pooled upload buffer size for GPU Scene, and ensuring any modifications to this value are done in a thread-safe manner, preferably through the provided console variable system.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GPUScene.cpp:66

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarGPUSceneMaxPooledUploadBufferSize(
	TEXT("r.GPUScene.MaxPooledUploadBufferSize"),
	256000,
	TEXT("Maximum size of GPU Scene upload buffer size to pool."),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarGPUSceneParallelUpdate(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GPUScene.cpp:65

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarGPUSceneMaxPooledUploadBufferSize(
	TEXT("r.GPUScene.MaxPooledUploadBufferSize"),
	256000,
	TEXT("Maximum size of GPU Scene upload buffer size to pool."),
	ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GPUScene.cpp:1407

Scope (from outer to inner):

file
function     void FGPUScene::UploadGeneral

Source code excerpt:

		}
	}
	const uint32 MaxPooledSize = uint32(CVarGPUSceneMaxPooledUploadBufferSize.GetValueOnRenderThread());
	if (PrimitiveUploadBuffer.GetNumBytes() > MaxPooledSize)
	{
		PrimitiveUploadBuffer.Release();
	}

	if (InstanceSceneUploadBuffer.GetNumBytes() > MaxPooledSize)