PoolSizeVRAMPercentage
PoolSizeVRAMPercentage
#Overview
name: PoolSizeVRAMPercentage
The value of this variable can be defined or overridden in .ini config files. 5
.ini config files referencing this setting variable.
It is referenced in 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of PoolSizeVRAMPercentage is to control the size of the texture pool as a percentage of the total available video memory (VRAM) in the graphics system. This setting is primarily used for texture streaming and memory management in the rendering system of Unreal Engine 5.
Based on the callsites, this setting variable is relied upon by multiple Unreal Engine graphics subsystems, including:
- Metal RHI (for Apple platforms)
- Direct3D 12 RHI
- OpenGL RHI
- Vulkan RHI
- Direct3D 11 RHI
The value of this variable is typically set through the engine configuration file (GEngineIni) under the “TextureStreaming” section. It’s read using the GConfig->GetInt() function in various RHI initialization functions.
This variable interacts closely with GTexturePoolSize, which is calculated based on PoolSizeVRAMPercentage and the total available graphics memory. The relationship is as follows:
- If PoolSizeVRAMPercentage is greater than 0 and total graphics memory is known,
- GTexturePoolSize is calculated as a percentage of the total graphics memory.
Developers should be aware of the following when using this variable:
- It’s a percentage value, so it should be set between 0 and 100.
- A value of 0 means the texture pool size will not be automatically calculated based on VRAM.
- It’s platform-specific; some platforms may not use this setting (e.g., it’s explicitly checked only for Windows and Linux in the OpenGL implementation).
Best practices when using this variable include:
- Set it to an appropriate value based on the target hardware and the game’s texture requirements.
- Monitor texture streaming performance and adjust as needed.
- Consider platform-specific requirements and limitations when setting this value.
- Use in conjunction with other texture streaming settings for optimal performance.
- Be cautious when setting high values, as it might leave insufficient memory for other system needs.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/IOS/BaseIOSEngine.ini:111, section: [TextureStreaming]
- INI Section:
TextureStreaming
- Raw value:
70
- Is Array:
False
Location: <Workspace>/Engine/Config/Linux/LinuxEngine.ini:19, section: [TextureStreaming]
- INI Section:
TextureStreaming
- Raw value:
70
- Is Array:
False
Location: <Workspace>/Engine/Config/LinuxArm64/LinuxArm64Engine.ini:20, section: [TextureStreaming]
- INI Section:
TextureStreaming
- Raw value:
70
- Is Array:
False
Location: <Workspace>/Engine/Config/Mac/BaseMacEngine.ini:28, section: [TextureStreaming]
- INI Section:
TextureStreaming
- Raw value:
70
- Is Array:
False
Location: <Workspace>/Engine/Config/Windows/WindowsEngine.ini:12, section: [TextureStreaming]
- INI Section:
TextureStreaming
- Raw value:
70
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Apple/MetalRHI/Private/MetalRHI.cpp:527
Scope: file
Source code excerpt:
GPoolSizeVRAMPercentage = 0;
GTexturePoolSize = 0;
GConfig->GetInt(TEXT("TextureStreaming"), TEXT("PoolSizeVRAMPercentage"), GPoolSizeVRAMPercentage, GEngineIni);
if ( GPoolSizeVRAMPercentage > 0 && MemoryStats.TotalGraphicsMemory > 0 )
{
float PoolSize = float(GPoolSizeVRAMPercentage) * 0.01f * float(MemoryStats.TotalGraphicsMemory);
// Truncate GTexturePoolSize to MB (but still counted in bytes)
GTexturePoolSize = int64(FGenericPlatformMath::TruncToFloat(PoolSize / 1024.0f / 1024.0f)) * 1024 * 1024;
#Loc: <Workspace>/Engine/Source/Runtime/D3D12RHI/Private/D3D12RHI.cpp:87
Scope (from outer to inner):
file
function FD3D12DynamicRHI::FD3D12DynamicRHI
Source code excerpt:
GPoolSizeVRAMPercentage = 0;
GTexturePoolSize = 0;
GConfig->GetInt(TEXT("TextureStreaming"), TEXT("PoolSizeVRAMPercentage"), GPoolSizeVRAMPercentage, GEngineIni);
GRHITransitionPrivateData_SizeInBytes = sizeof(FD3D12TransitionData);
GRHITransitionPrivateData_AlignInBytes = alignof(FD3D12TransitionData);
// Initialize the platform pixel format map.
GPixelFormats[PF_Unknown ].PlatformFormat = DXGI_FORMAT_UNKNOWN;
#Loc: <Workspace>/Engine/Source/Runtime/OpenGLDrv/Private/OpenGLDevice.cpp:865
Scope (from outer to inner):
file
function static void InitRHICapabilitiesForGL
Source code excerpt:
GPoolSizeVRAMPercentage = 0;
#if PLATFORM_WINDOWS || PLATFORM_LINUX
GConfig->GetInt( TEXT( "TextureStreaming" ), TEXT( "PoolSizeVRAMPercentage" ), GPoolSizeVRAMPercentage, GEngineIni );
#endif
// GL vendor and version information.
#if !defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) && !(defined(_MSC_VER) && _MSC_VER >= 1900)
#define LOG_GL_STRING(StringEnum) UE_LOG(LogRHI, Log, TEXT(" ") ## TEXT(#StringEnum) ## TEXT(": %s"), ANSI_TO_TCHAR((const ANSICHAR*)glGetString(StringEnum)))
#else
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Public/RHIGlobals.h:387
Scope: file
Source code excerpt:
/** In percent. If non-zero, the texture pool size is a percentage of TotalGraphicsMemory. */
int32 PoolSizeVRAMPercentage = 0;
/** Amount of local video memory demoted to system memory. In bytes. */
uint64 DemotedLocalMemorySize = 0;
/** Amount of memory allocated by buffers */
volatile uint64 BufferMemorySize = 0;
#Loc: <Workspace>/Engine/Source/Runtime/VulkanRHI/Private/VulkanRHI.cpp:511
Scope (from outer to inner):
file
function FVulkanDynamicRHI::FVulkanDynamicRHI
Source code excerpt:
GRHITransitionPrivateData_SizeInBytes = sizeof(FVulkanPipelineBarrier);
GRHITransitionPrivateData_AlignInBytes = alignof(FVulkanPipelineBarrier);
GConfig->GetInt(TEXT("TextureStreaming"), TEXT("PoolSizeVRAMPercentage"), GPoolSizeVRAMPercentage, GEngineIni);
GRHIGlobals.SupportsBarycentricsSemantic = true;
static const auto CVarPSOPrecaching = IConsoleManager::Get().FindConsoleVariable(TEXT("r.PSOPrecaching"));
GRHISupportsPSOPrecaching = FVulkanChunkedPipelineCacheManager::IsEnabled() && (CVarPSOPrecaching && CVarPSOPrecaching->GetInt() != 0) && CVarAllowVulkanPSOPrecache.GetValueOnAnyThread();
#Loc: <Workspace>/Engine/Source/Runtime/Windows/D3D11RHI/Private/D3D11Device.cpp:78
Scope (from outer to inner):
file
function FD3D11DynamicRHI::FD3D11DynamicRHI
Source code excerpt:
GPoolSizeVRAMPercentage = 0;
GTexturePoolSize = 0;
GConfig->GetInt( TEXT( "TextureStreaming" ), TEXT( "PoolSizeVRAMPercentage" ), GPoolSizeVRAMPercentage, GEngineIni );
// Initialize the RHI capabilities.
check(FeatureLevel >= D3D_FEATURE_LEVEL_11_0);
TRefCountPtr<IDXGIFactory5> Factory5;