AllowAsyncRenderThreadUpdatesEditorGameWorld
AllowAsyncRenderThreadUpdatesEditorGameWorld
#Overview
name: AllowAsyncRenderThreadUpdatesEditorGameWorld
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Used to control async renderthread updates in an editor game world.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of AllowAsyncRenderThreadUpdatesEditorGameWorld is to control asynchronous render thread updates in an editor game world within Unreal Engine 5.
This setting variable is primarily used by the rendering system, specifically for managing updates in the context of the editor’s game world. It is part of the Engine module, as evidenced by its location in the Engine/Private/LevelTick.cpp file.
The value of this variable is set through a console variable (CVar) system. It is defined as a TAutoConsoleVariable with an initial value of 0, which means asynchronous render thread updates are disabled by default in the editor game world.
This variable interacts closely with another variable, CVarAllowAsyncRenderThreadUpdatesEditor, which serves a similar purpose but for the editor in general, not specifically the game world within the editor.
Developers must be aware that this variable affects the behavior of render thread updates in the editor’s game world. When set to 0 (default), it forces updates to occur on the game thread, which may impact performance but ensure synchronization. When set to a value greater than 0, it allows for asynchronous updates, potentially improving performance but introducing the possibility of race conditions or visual artifacts.
Best practices when using this variable include:
- Only enabling it (setting to > 0) when necessary for performance reasons.
- Testing thoroughly to ensure no visual artifacts or unexpected behaviors occur when enabled.
- Considering the interaction with CVarAllowAsyncRenderThreadUpdatesEditor and ensuring consistent settings between the two when appropriate.
Regarding the associated variable CVarAllowAsyncRenderThreadUpdatesEditorGameWorld:
This is the actual console variable that controls the behavior described above. It is used in the UWorld::MarkActorComponentForNeededEndOfFrameUpdate function to determine whether to force updates on the game thread or allow them to occur asynchronously on the render thread.
The variable is checked using the GetValueOnAnyThread() method, which suggests that it can be accessed from multiple threads. Developers should be cautious when modifying this value during runtime, as it could lead to inconsistent behavior if changed while updates are in progress.
When working with this variable, developers should consider the following:
- Understand the performance implications of enabling or disabling asynchronous updates.
- Be aware of the different behavior between game worlds and non-game worlds in the editor.
- Use in conjunction with profiling tools to determine the optimal setting for your specific use case.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LevelTick.cpp:783
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarAllowAsyncRenderThreadUpdatesEditorGameWorld(
TEXT("AllowAsyncRenderThreadUpdatesEditorGameWorld"),
0,
TEXT("Used to control async renderthread updates in an editor game world."));
static TAutoConsoleVariable<int32> CVarAllowAsyncRenderThreadUpdatesEditor(
TEXT("AllowAsyncRenderThreadUpdatesEditor"),
0,
#Associated Variable and Callsites
This variable is associated with another variable named CVarAllowAsyncRenderThreadUpdatesEditorGameWorld
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LevelTick.cpp:782
Scope: file
Source code excerpt:
TEXT("If > 0 then we do the gamethread updates _while_ doing parallel updates."));
static TAutoConsoleVariable<int32> CVarAllowAsyncRenderThreadUpdatesEditorGameWorld(
TEXT("AllowAsyncRenderThreadUpdatesEditorGameWorld"),
0,
TEXT("Used to control async renderthread updates in an editor game world."));
static TAutoConsoleVariable<int32> CVarAllowAsyncRenderThreadUpdatesEditor(
TEXT("AllowAsyncRenderThreadUpdatesEditor"),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LevelTick.cpp:911
Scope (from outer to inner):
file
function void UWorld::MarkActorComponentForNeededEndOfFrameUpdate
Source code excerpt:
if (IsGameWorld())
{
bForceGameThread = !CVarAllowAsyncRenderThreadUpdatesEditorGameWorld.GetValueOnAnyThread();
}
else
{
bForceGameThread = !CVarAllowAsyncRenderThreadUpdatesEditor.GetValueOnAnyThread();
}
#else