r.Nanite.MaterialBuffers.AsyncUpdates
r.Nanite.MaterialBuffers.AsyncUpdates
#Overview
name: r.Nanite.MaterialBuffers.AsyncUpdates
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
When non-zero, Nanite material data buffer updates are updated asynchronously.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Nanite.MaterialBuffers.AsyncUpdates is to control whether Nanite material data buffer updates are performed asynchronously or not. This setting is related to the rendering system, specifically the Nanite geometry system in Unreal Engine 5.
This setting variable is primarily used in the Nanite subsystem of Unreal Engine’s rendering module. Based on the callsites, it’s evident that this variable is utilized in the NaniteMaterialsSceneExtension.cpp file, which is part of the Renderer’s private implementation.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of true, meaning asynchronous updates are enabled by default. Developers can change this value at runtime using console commands or through project settings.
The associated variable CVarNaniteMaterialBufferAsyncUpdates directly interacts with r.Nanite.MaterialBuffers.AsyncUpdates. They share the same value and purpose.
Developers must be aware that this variable affects the performance and behavior of Nanite material buffer updates. When set to true (non-zero), updates are performed asynchronously, which can improve performance by allowing other operations to continue while the update is in progress. However, this might introduce a slight delay in applying material changes.
Best practices when using this variable include:
- Leave it enabled (true) for most scenarios to benefit from asynchronous updates and better performance.
- Consider disabling it (set to false) if you need immediate, synchronous updates of material data and can afford the potential performance cost.
- Profile your application with both settings to determine which provides the best balance of performance and visual update responsiveness for your specific use case.
Regarding the associated variable CVarNaniteMaterialBufferAsyncUpdates:
The purpose of CVarNaniteMaterialBufferAsyncUpdates is identical to r.Nanite.MaterialBuffers.AsyncUpdates. It’s the actual console variable that controls the asynchronous update behavior of Nanite material buffers.
This variable is used in the Nanite subsystem of the rendering module, specifically in the MaterialsSceneExtension class.
The value is set when the console variable is created, with a default of true. It can be modified at runtime through console commands.
CVarNaniteMaterialBufferAsyncUpdates directly controls the behavior of the Nanite material buffer update system. It’s read in the FMaterialsSceneExtension::FUpdater constructor to determine whether async updates should be enabled.
Developers should be aware that changes to this variable will immediately affect the behavior of Nanite material updates. It’s thread-safe for the render thread, as indicated by the ECVF_RenderThreadSafe flag.
Best practices for using CVarNaniteMaterialBufferAsyncUpdates are the same as those for r.Nanite.MaterialBuffers.AsyncUpdates, as they represent the same setting.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteMaterialsSceneExtension.cpp:19
Scope: file
Source code excerpt:
static TAutoConsoleVariable<bool> CVarNaniteMaterialBufferAsyncUpdates(
TEXT("r.Nanite.MaterialBuffers.AsyncUpdates"),
true,
TEXT("When non-zero, Nanite material data buffer updates are updated asynchronously."),
ECVF_RenderThreadSafe
);
static int32 GNaniteMaterialBufferForceFullUpload = 0;
#Associated Variable and Callsites
This variable is associated with another variable named CVarNaniteMaterialBufferAsyncUpdates
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteMaterialsSceneExtension.cpp:18
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<bool> CVarNaniteMaterialBufferAsyncUpdates(
TEXT("r.Nanite.MaterialBuffers.AsyncUpdates"),
true,
TEXT("When non-zero, Nanite material data buffer updates are updated asynchronously."),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteMaterialsSceneExtension.cpp:288
Scope (from outer to inner):
file
function FMaterialsSceneExtension::FUpdater::FUpdater
Source code excerpt:
FMaterialsSceneExtension::FUpdater::FUpdater(FMaterialsSceneExtension& InSceneData) :
SceneData(&InSceneData),
bEnableAsync(CVarNaniteMaterialBufferAsyncUpdates.GetValueOnRenderThread())
{
}
void FMaterialsSceneExtension::FUpdater::End()
{
// Ensure these tasks finish before we fall out of scope.