r.Vulkan.PipelineDebugForceEvictImmediately

r.Vulkan.PipelineDebugForceEvictImmediately

#Overview

name: r.Vulkan.PipelineDebugForceEvictImmediately

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.PipelineDebugForceEvictImmediately is to force all created Pipeline State Objects (PSOs) to be evicted immediately in the Vulkan rendering system. This setting is specifically designed for debugging purposes within Unreal Engine’s Vulkan implementation.

This setting variable is primarily used in the Vulkan RHI (Rendering Hardware Interface) subsystem of Unreal Engine 5. It is part of the rendering pipeline, specifically the pipeline state management for Vulkan.

The value of this variable is set through the Unreal Engine console variable system. It is defined as a TAutoConsoleVariable with an initial value of 0, meaning it’s disabled by default.

The associated variable CVarPipelineDebugForceEvictImmediately directly interacts with r.Vulkan.PipelineDebugForceEvictImmediately. They share the same value and purpose.

Developers must be aware that:

  1. This variable is intended for debugging only and should not be used in production builds.
  2. Enabling this (by setting it to 1) will likely have a severe performance impact, as it forces all PSOs to be evicted immediately after creation.
  3. It is marked as ECVF_RenderThreadSafe and ECVF_ReadOnly, meaning it’s safe to read from the render thread, but its value cannot be changed at runtime.

Best practices when using this variable include:

  1. Only enable it when specifically debugging pipeline state issues in Vulkan.
  2. Be prepared for significant performance degradation when enabled.
  3. Always disable it before creating production builds.
  4. Use in conjunction with other Vulkan debugging tools for comprehensive pipeline state analysis.

Regarding the associated variable CVarPipelineDebugForceEvictImmediately:

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


TAutoConsoleVariable<int32> CVarPipelineDebugForceEvictImmediately(
	TEXT("r.Vulkan.PipelineDebugForceEvictImmediately"),
	0,
	TEXT("1: Force all created PSOs to be evicted immediately. Only for debugging"),
	ECVF_RenderThreadSafe | ECVF_ReadOnly);

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

static const double HitchTime = 1.0 / 1000.0;

TAutoConsoleVariable<int32> CVarPipelineDebugForceEvictImmediately(
	TEXT("r.Vulkan.PipelineDebugForceEvictImmediately"),
	0,
	TEXT("1: Force all created PSOs to be evicted immediately. Only for debugging"),
	ECVF_RenderThreadSafe | ECVF_ReadOnly);

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

Scope (from outer to inner):

file
function     FGraphicsPipelineStateRHIRef FVulkanPipelineStateCacheManager::RHICreateGraphicsPipelineState

Source code excerpt:

			if((!bIsPrecache || !LRUEvictImmediately()) 
	#if !UE_BUILD_SHIPPING
				&& 0 == CVarPipelineDebugForceEvictImmediately.GetValueOnAnyThread()
	#endif
				)
			{

				// Create the pipeline
				double BeginTime = FPlatformTime::Seconds();