r.Vulkan.PipelineLRUCapactiy
r.Vulkan.PipelineLRUCapactiy
#Overview
name: r.Vulkan.PipelineLRUCapactiy
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Maximum no. of PSOs in LRU.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Vulkan.PipelineLRUCapactiy is to control the maximum number of Pipeline State Objects (PSOs) in the Least Recently Used (LRU) cache for the Vulkan rendering system in Unreal Engine 5.
This setting variable is primarily used by the Vulkan RHI (Rendering Hardware Interface) subsystem of Unreal Engine 5. It is specifically related to the pipeline state management in the Vulkan renderer.
The value of this variable is set through a console variable (CVar) system. It is defined as a TAutoConsoleVariable with the name “r.Vulkan.PipelineLRUCapactiy” and a default value of LRU_PIPELINE_CAPACITY.
The associated variable CVarLRUPipelineCapacity interacts directly with r.Vulkan.PipelineLRUCapactiy. They share the same value and are used interchangeably in the code.
Developers should be aware that this variable is marked as ECVF_RenderThreadSafe and ECVF_ReadOnly. This means it can be safely accessed from the render thread, but its value cannot be changed at runtime.
Best practices when using this variable include:
- Consider the trade-off between memory usage and performance when adjusting this value.
- Monitor performance impact when modifying this value, as it directly affects the pipeline state caching behavior.
- Be cautious about setting extremely large values, as it might lead to excessive memory consumption.
Regarding the associated variable CVarLRUPipelineCapacity:
- Its purpose is the same as r.Vulkan.PipelineLRUCapactiy – to control the maximum number of PSOs in the LRU cache.
- It is used in the FVulkanPipelineStateCacheManager constructor to initialize the LRUUsedPipelineMax member variable.
- The value is retrieved using the GetValueOnAnyThread() method, indicating it can be safely accessed from any thread.
- Developers should treat this variable as read-only and use it for accessing the current LRU capacity setting in their code.
- Best practices include using this variable for runtime checks or logging, but not attempting to modify its value directly.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/VulkanRHI/Private/VulkanPipeline.cpp:90
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarLRUPipelineCapacity(
TEXT("r.Vulkan.PipelineLRUCapactiy"),
LRU_PIPELINE_CAPACITY,
TEXT("Maximum no. of PSOs in LRU."),
ECVF_RenderThreadSafe| ECVF_ReadOnly);
#Associated Variable and Callsites
This variable is associated with another variable named CVarLRUPipelineCapacity
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/VulkanRHI/Private/VulkanPipeline.cpp:89
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
TAutoConsoleVariable<int32> CVarLRUPipelineCapacity(
TEXT("r.Vulkan.PipelineLRUCapactiy"),
LRU_PIPELINE_CAPACITY,
TEXT("Maximum no. of PSOs in LRU."),
ECVF_RenderThreadSafe| ECVF_ReadOnly);
#Loc: <Workspace>/Engine/Source/Runtime/VulkanRHI/Private/VulkanPipeline.cpp:292
Scope (from outer to inner):
file
function FVulkanPipelineStateCacheManager::FVulkanPipelineStateCacheManager
Source code excerpt:
{
bUseLRU = (int32)CVarEnableLRU.GetValueOnAnyThread() != 0;
LRUUsedPipelineMax = CVarLRUPipelineCapacity.GetValueOnAnyThread();
}
FVulkanPipelineStateCacheManager::~FVulkanPipelineStateCacheManager()
{
if (OnShaderPipelineCacheOpenedDelegate.IsValid())