r.PSOPrecache.DitheredLODFadingOutMaskPass

r.PSOPrecache.DitheredLODFadingOutMaskPass

#Overview

name: r.PSOPrecache.DitheredLODFadingOutMaskPass

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.PSOPrecache.DitheredLODFadingOutMaskPass is to control the precaching of Pipeline State Objects (PSOs) for the DitheredLODFadingOutMaskPass in Unreal Engine 5’s rendering system.

This setting variable is primarily used by the rendering system, specifically in the depth rendering module. It’s part of the PSO precaching optimization system, which aims to improve rendering performance by precompiling shader pipelines.

The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable with an initial value of 0, meaning by default, no PSOs are compiled for this pass.

The associated variable CVarPSOPrecacheDitheredLODFadingOutMaskPass directly interacts with it. They share the same value and purpose.

Developers must be aware that:

  1. This variable is read-only (ECVF_ReadOnly), meaning it cannot be changed at runtime.
  2. It has two possible values: 0 (default, no PSO precaching) and 1 (PSO precaching enabled for all primitives rendering to depth pass).
  3. Changing this value can affect rendering performance and initial load times.

Best practices when using this variable include:

  1. Only enable PSO precaching (set to 1) if you’re experiencing performance issues related to shader compilation during the DitheredLODFadingOutMaskPass.
  2. Be aware that enabling precaching may increase initial load times but could improve runtime performance.
  3. Test thoroughly with both settings to determine the best option for your specific use case.

Regarding the associated variable CVarPSOPrecacheDitheredLODFadingOutMaskPass:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DepthRendering.cpp:75

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarPSOPrecacheDitheredLODFadingOutMaskPass(
	TEXT("r.PSOPrecache.DitheredLODFadingOutMaskPass"),
	0,
	TEXT("Precache PSOs for DitheredLODFadingOutMaskPass.\n") \
	TEXT(" 0: No PSOs are compiled for this pass (default).\n") \
	TEXT(" 1: PSOs are compiled for all primitives which render to depth pass.\n"),
	ECVF_ReadOnly
);

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DepthRendering.cpp:74

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe | ECVF_ReadOnly);

static TAutoConsoleVariable<int32> CVarPSOPrecacheDitheredLODFadingOutMaskPass(
	TEXT("r.PSOPrecache.DitheredLODFadingOutMaskPass"),
	0,
	TEXT("Precache PSOs for DitheredLODFadingOutMaskPass.\n") \
	TEXT(" 0: No PSOs are compiled for this pass (default).\n") \
	TEXT(" 1: PSOs are compiled for all primitives which render to depth pass.\n"),
	ECVF_ReadOnly

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DepthRendering.cpp:1103

Scope (from outer to inner):

file
function     void FDepthPassMeshProcessor::CollectPSOInitializers

Source code excerpt:


	// PSO precaching enabled for DitheredLODFadingOutMaskPass
	if (MeshPassType == EMeshPass::DitheredLODFadingOutMaskPass && CVarPSOPrecacheDitheredLODFadingOutMaskPass.GetValueOnAnyThread() == 0)
	{
		return;
	}

	const bool bIsTranslucent = IsTranslucentBlendMode(Material);