r.VT.AsyncPageRequestTask
r.VT.AsyncPageRequestTask
#Overview
name: r.VT.AsyncPageRequestTask
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Performs VT page requests on an async task.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.VT.AsyncPageRequestTask is to control whether Virtual Texture (VT) page requests are performed on an asynchronous task. This variable is part of the Virtual Texturing system in Unreal Engine’s rendering pipeline.
The Unreal Engine subsystem that relies on this setting variable is the Renderer module, specifically the Virtual Texture System. This can be seen from the file path where the variable is defined and used: ‘Engine/Source/Runtime/Renderer/Private/VT/VirtualTextureSystem.cpp’.
The value of this variable is set using a console variable (CVar) system. It’s initialized with a default value of 1, meaning that by default, VT page requests are performed on an async task.
This variable interacts closely with its associated variable CVarVTAsyncPageRequestTask. 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 Texturing system. When enabled (set to 1), it allows VT page requests to be processed asynchronously, which can potentially improve performance by offloading work from the main thread.
Best practices when using this variable include:
- Consider the trade-offs between synchronous and asynchronous page requests for your specific use case.
- Monitor performance metrics when changing this setting to ensure it’s beneficial for your project.
- Be aware of potential race conditions or timing issues that might arise from asynchronous processing.
Regarding the associated variable CVarVTAsyncPageRequestTask:
The purpose of CVarVTAsyncPageRequestTask is the same as r.VT.AsyncPageRequestTask. It’s the actual console variable that controls whether VT page requests are performed on an async task.
This variable is defined and used in the same Renderer module, specifically in the Virtual Texture System.
The value of CVarVTAsyncPageRequestTask is set when the engine initializes the console variables. It can be changed at runtime through console commands.
CVarVTAsyncPageRequestTask interacts directly with the FVirtualTextureUpdater class. Its value is checked in the BeginUpdate function to determine if async tasks are allowed.
Developers should be aware that changing this variable at runtime will affect the behavior of the Virtual Texturing system immediately.
Best practices for CVarVTAsyncPageRequestTask are similar to those for r.VT.AsyncPageRequestTask. Additionally, developers should ensure that any code relying on the async behavior of VT page requests is designed to handle both synchronous and asynchronous scenarios gracefully.
#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:159
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarVTAsyncPageRequestTask(
TEXT("r.VT.AsyncPageRequestTask"),
1,
TEXT("Performs VT page requests on an async task."),
ECVF_RenderThreadSafe
);
FVirtualTextureUpdateSettings::FVirtualTextureUpdateSettings()
#Associated Variable and Callsites
This variable is associated with another variable named CVarVTAsyncPageRequestTask
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VT/VirtualTextureSystem.cpp:158
Scope: file
Source code excerpt:
ECVF_Default
);
static TAutoConsoleVariable<int32> CVarVTAsyncPageRequestTask(
TEXT("r.VT.AsyncPageRequestTask"),
1,
TEXT("Performs VT page requests on an async task."),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VT/VirtualTextureSystem.cpp:2778
Scope (from outer to inner):
file
function TUniquePtr<FVirtualTextureUpdater> FVirtualTextureSystem::BeginUpdate
Source code excerpt:
Updater->Settings = Settings;
Updater->FeatureLevel = FeatureLevel;
Updater->bAsyncTaskAllowed = Settings.bEnableAsyncTasks && CVarVTAsyncPageRequestTask.GetValueOnRenderThread();
if (Updater->bAsyncTaskAllowed)
{
BeginUpdate(GraphBuilder, Updater.Get());
}