r.Vulkan.PipelineLRUCacheEvictBinaryPreloadScreen

r.Vulkan.PipelineLRUCacheEvictBinaryPreloadScreen

#Overview

name: r.Vulkan.PipelineLRUCacheEvictBinaryPreloadScreen

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.Vulkan.PipelineLRUCacheEvictBinaryPreloadScreen is to control the use of a preload screen while loading pre-evicted Pipeline State Objects (PSOs) in the Vulkan rendering system of Unreal Engine 5.

This setting variable is primarily used by the Vulkan RHI (Render Hardware Interface) subsystem, specifically within the pipeline management component. It’s part of the rendering system, focusing on the Vulkan graphics API implementation.

The value of this variable is set through the Unreal Engine console variable system. It’s defined as an integer with a default value of 0, where 1 enables the use of a preload screen.

The variable interacts closely with the pipeline LRU (Least Recently Used) cache eviction system. It’s associated with CVarPipelineLRUCacheEvictBinaryPreloadScreen, which shares the same value and purpose.

Developers should be aware that enabling this variable (setting it to 1) will cause the engine to display a preload screen while loading pre-evicted PSOs. This can be useful for managing loading times and user experience, especially on platforms where pipeline compilation might be slow.

Best practices when using this variable include:

  1. Only enable it if you’re experiencing issues with pipeline compilation times affecting user experience.
  2. Use it in conjunction with other Vulkan pipeline optimization settings.
  3. Test thoroughly on target platforms to ensure it provides the desired effect without negatively impacting performance.

Regarding the associated variable CVarPipelineLRUCacheEvictBinaryPreloadScreen:

The purpose of CVarPipelineLRUCacheEvictBinaryPreloadScreen is identical to r.Vulkan.PipelineLRUCacheEvictBinaryPreloadScreen. It’s an internal representation of the console variable within the C++ code.

This variable is used directly in the Vulkan pipeline state cache manager, specifically in the OnShaderPipelineCacheOpened function. It’s checked to determine whether to set the precompilation as a slow task, which likely triggers the preload screen.

The value is set and accessed using the Unreal Engine’s console variable system, typically through CVarPipelineLRUCacheEvictBinaryPreloadScreen.GetValueOnAnyThread().

It interacts with other variables and conditions in the pipeline cache management system, such as bPrecompilingCacheLoadedFromFile and bEvictImmediately.

Developers should be aware that this variable’s effect is tied to the eviction of pipeline cache entries and the subsequent recompilation process. It’s particularly relevant for Android platforms, as evidenced by the platform-specific code following its check.

Best practices include using this variable in conjunction with other pipeline optimization techniques and thoroughly testing its impact on different hardware configurations, especially on mobile platforms where pipeline compilation can be a significant performance factor.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/VulkanRHI/Private/VulkanPipeline.cpp:62

Scope: file

Source code excerpt:


TAutoConsoleVariable<int32> CVarPipelineLRUCacheEvictBinaryPreloadScreen(
	TEXT("r.Vulkan.PipelineLRUCacheEvictBinaryPreloadScreen"),
	0,
	TEXT("1: Use a preload screen while loading preevicted PSOs ala r.Vulkan.PipelineLRUCacheEvictBinary"),
	ECVF_RenderThreadSafe);

TAutoConsoleVariable<int32> CVarEnableLRU(
	TEXT("r.Vulkan.EnablePipelineLRUCache"),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/VulkanRHI/Private/VulkanPipeline.cpp:61

Scope: file

Source code excerpt:



TAutoConsoleVariable<int32> CVarPipelineLRUCacheEvictBinaryPreloadScreen(
	TEXT("r.Vulkan.PipelineLRUCacheEvictBinaryPreloadScreen"),
	0,
	TEXT("1: Use a preload screen while loading preevicted PSOs ala r.Vulkan.PipelineLRUCacheEvictBinary"),
	ECVF_RenderThreadSafe);

TAutoConsoleVariable<int32> CVarEnableLRU(

#Loc: <Workspace>/Engine/Source/Runtime/VulkanRHI/Private/VulkanPipeline.cpp:565

Scope (from outer to inner):

file
function     void FVulkanPipelineStateCacheManager::OnShaderPipelineCacheOpened

Source code excerpt:



	if (!bPrecompilingCacheLoadedFromFile || (bEvictImmediately && CVarPipelineLRUCacheEvictBinaryPreloadScreen.GetValueOnAnyThread()))
	{
		ShaderCachePrecompileContext.SetPrecompilationIsSlowTask();
#if PLATFORM_ANDROID
		if (GNumRemoteProgramCompileServices)
		{
			FVulkanAndroidPlatform::StartAndWaitForRemoteCompileServices(GNumRemoteProgramCompileServices);