r.VT.PageUpdateFlushCount

r.VT.PageUpdateFlushCount

#Overview

name: r.VT.PageUpdateFlushCount

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.VT.PageUpdateFlushCount is to control the buffering of page updates in the Virtual Texture (VT) system before attempting to flush by taking a lock. This setting is part of Unreal Engine 5’s rendering system, specifically the Virtual Texture subsystem.

The Unreal Engine subsystem that relies on this setting variable is the Renderer module, particularly the Virtual Texture system. This can be inferred from the file path “Engine/Source/Runtime/Renderer/Private/VT/VirtualTextureSystem.cpp”.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 8, but can be changed at runtime through console commands or configuration files.

This variable interacts with an associated variable named CVarVTPageUpdateFlushCount. They share the same value and are used interchangeably in the code.

Developers must be aware that this variable affects the performance and behavior of the Virtual Texture system. A higher value means more page updates will be buffered before flushing, which could potentially improve performance by reducing lock contention, but might also increase memory usage and latency in updating textures.

Best practices when using this variable include:

  1. Adjust the value based on the specific needs of your project and target hardware.
  2. Monitor performance metrics when changing this value to ensure it’s having the desired effect.
  3. Be cautious about setting extremely high values, as this could lead to increased memory usage.
  4. Consider the trade-off between update latency and performance when adjusting this value.

Regarding the associated variable CVarVTPageUpdateFlushCount:

The purpose of CVarVTPageUpdateFlushCount is the same as r.VT.PageUpdateFlushCount. It’s an internal representation of the console variable in the C++ code.

This variable is used within the FVirtualTextureUpdateSettings constructor to set the MaxGatherPagesBeforeFlush value. This suggests that it directly influences the behavior of the Virtual Texture update process.

The value of CVarVTPageUpdateFlushCount is retrieved using the GetValueOnRenderThread() method, indicating that it’s designed to be safely accessed from the render thread.

Developers should be aware that changes to r.VT.PageUpdateFlushCount will affect the behavior of code that uses CVarVTPageUpdateFlushCount. They should ensure that any custom code interacting with the Virtual Texture system takes this setting into account.

Best practices for CVarVTPageUpdateFlushCount are similar to those for r.VT.PageUpdateFlushCount, with the additional note that developers should use the appropriate thread-safe methods (like GetValueOnRenderThread()) when accessing this variable in custom code.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VT/VirtualTextureSystem.cpp:116

Scope: file

Source code excerpt:

);
static TAutoConsoleVariable<int32> CVarVTPageUpdateFlushCount(
	TEXT("r.VT.PageUpdateFlushCount"),
	8,
	TEXT("Number of page updates to buffer before attempting to flush by taking a lock."),
	ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarVTForceContinuousUpdate(
	TEXT("r.VT.ForceContinuousUpdate"),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VT/VirtualTextureSystem.cpp:115

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarVTPageUpdateFlushCount(
	TEXT("r.VT.PageUpdateFlushCount"),
	8,
	TEXT("Number of page updates to buffer before attempting to flush by taking a lock."),
	ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarVTForceContinuousUpdate(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VT/VirtualTextureSystem.cpp:173

Scope (from outer to inner):

file
function     FVirtualTextureUpdateSettings::FVirtualTextureUpdateSettings

Source code excerpt:

	NumFeedbackTasks = CVarVTNumFeedbackTasks.GetValueOnRenderThread();
	NumGatherTasks = CVarVTNumGatherTasks.GetValueOnRenderThread();
	MaxGatherPagesBeforeFlush = CVarVTPageUpdateFlushCount.GetValueOnRenderThread();
	MaxRVTPageUploads = VirtualTextureScalability::GetMaxUploadsPerFrame();
	MaxSVTPageUploads = VirtualTextureScalability::GetMaxUploadsPerFrameForStreamingVT();
	MaxPagesProduced = VirtualTextureScalability::GetMaxPagesProducedPerFrame();
	MaxContinuousUpdates = VirtualTextureScalability::GetMaxContinuousUpdatesPerFrame();
}