r.VT.SyncProduceLockedTiles

r.VT.SyncProduceLockedTiles

#Overview

name: r.VT.SyncProduceLockedTiles

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.SyncProduceLockedTiles is to control synchronous loading behavior when producing locked tiles in Unreal Engine’s Virtual Texturing system. This setting is part of the rendering subsystem, specifically the Virtual Texturing (VT) component.

This setting variable is primarily used in the Renderer module of Unreal Engine, as evidenced by its location in the VirtualTextureSystem.cpp file within the Runtime/Renderer/Private/VT directory.

The value of this variable is set through a console variable (CVarVTSyncProduceLockedTiles) with a default value of 1, meaning synchronous loading is enabled by default. It can be changed at runtime through console commands or programmatically.

The associated variable CVarVTSyncProduceLockedTiles directly interacts with r.VT.SyncProduceLockedTiles. They share the same value and purpose.

Developers must be aware that this variable affects the performance and behavior of the Virtual Texturing system. When enabled (set to 1), it forces synchronous loading when producing locked tiles, which can impact frame rates but may improve texture quality in certain scenarios.

Best practices for using this variable include:

  1. Keeping it enabled (default value of 1) for most scenarios to ensure high-quality texture rendering.
  2. Considering disabling it (set to 0) in performance-critical situations where the slight delay in texture loading is acceptable.
  3. Monitoring performance metrics when adjusting this setting to find the optimal balance between texture quality and rendering speed for your specific use case.

Regarding the associated variable CVarVTSyncProduceLockedTiles:

The purpose of CVarVTSyncProduceLockedTiles is identical to r.VT.SyncProduceLockedTiles, as they are directly linked.

This variable is used in the Renderer module, specifically in the Virtual Texturing system implementation.

The value is set when the console variable is initialized, with a default value of 1. It can be accessed and modified at runtime using Unreal Engine’s console variable system.

CVarVTSyncProduceLockedTiles interacts directly with r.VT.SyncProduceLockedTiles, as they represent the same setting.

Developers should be aware that this is the actual variable used in the C++ code to control the synchronous loading behavior. Any runtime changes to r.VT.SyncProduceLockedTiles will be reflected in this variable.

Best practices for using CVarVTSyncProduceLockedTiles include:

  1. Using the GetValueOnRenderThread() method to safely access its value from the render thread.
  2. Avoiding direct modification of this variable; instead, use the console command system to change r.VT.SyncProduceLockedTiles.
  3. Consider caching the value if it’s accessed frequently in performance-critical code sections to avoid repeated calls to GetValueOnRenderThread().

#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:128

Scope: file

Source code excerpt:

);
static TAutoConsoleVariable<int32> CVarVTSyncProduceLockedTiles(
	TEXT("r.VT.SyncProduceLockedTiles"),
	1,
	TEXT("Should we sync loading when producing locked tiles"),
	ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarVTProduceLockedTilesOnFlush(
	TEXT("r.VT.ProduceLockedTilesOnFlush"),

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarVTSyncProduceLockedTiles(
	TEXT("r.VT.SyncProduceLockedTiles"),
	1,
	TEXT("Should we sync loading when producing locked tiles"),
	ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarVTProduceLockedTilesOnFlush(

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

Scope (from outer to inner):

file
function     void FVirtualTextureSystem::SubmitRequests

Source code excerpt:

		// When the root page is finally mapped we will return to normal high quality VT sampling.
		// todo[VT]: Make root pages always resident so that we never need to load sync the root pages.
		const bool bSyncProduceLockedTiles = CVarVTSyncProduceLockedTiles.GetValueOnRenderThread() != 0;
#endif

		bool bWaitForProducers = false;

		const uint32 MaxPagesProduced = Settings.MaxPagesProduced;
		const uint32 PageFreeThreshold = VirtualTextureScalability::GetPageFreeThreshold();