r.Nanite.AsyncRasterization
r.Nanite.AsyncRasterization
#Overview
name: r.Nanite.AsyncRasterization
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If available, run Nanite compute rasterization as asynchronous compute.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Nanite.AsyncRasterization is to control whether Nanite compute rasterization should run as asynchronous compute when available. This setting is part of Unreal Engine 5’s Nanite system, which is a virtualized geometry system for high-detail environments.
This setting variable is primarily used in the Nanite rendering subsystem, specifically in the rasterization process. It’s implemented in the Renderer module of Unreal Engine 5.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1 (enabled) but can be changed at runtime.
The associated variable CVarNaniteEnableAsyncRasterization directly interacts with r.Nanite.AsyncRasterization. They share the same value and purpose.
Developers should be aware that this variable only takes effect if certain conditions are met:
- Compute rasterization is enabled (controlled by another variable, CVarNaniteComputeRasterization).
- The hardware supports efficient asynchronous compute (GSupportsEfficientAsyncCompute).
- The RHI (Rendering Hardware Interface) supports certain multi-pipeline mergeable access flags.
Best practices when using this variable include:
- Consider the target hardware capabilities. If the target platforms don’t support efficient asynchronous compute, changing this setting won’t have any effect.
- Monitor performance impacts. While asynchronous compute can improve performance in many cases, it’s not always beneficial in all scenarios.
- Test with both enabled and disabled states to ensure your application performs well in both configurations.
Regarding the associated variable CVarNaniteEnableAsyncRasterization:
- Its purpose is identical to r.Nanite.AsyncRasterization.
- It’s used in the same Nanite rendering subsystem.
- Its value is set through the same CVar system.
- It interacts directly with r.Nanite.AsyncRasterization, effectively being an alias for it.
- The same considerations and best practices apply to this variable as to r.Nanite.AsyncRasterization.
Developers should treat CVarNaniteEnableAsyncRasterization as functionally identical to r.Nanite.AsyncRasterization. The duplication likely exists for internal code organization or historical reasons.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteCullRaster.cpp:49
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarNaniteEnableAsyncRasterization(
TEXT("r.Nanite.AsyncRasterization"),
1,
TEXT("If available, run Nanite compute rasterization as asynchronous compute."),
ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarNaniteAsyncRasterizeShadowDepths(
#Associated Variable and Callsites
This variable is associated with another variable named CVarNaniteEnableAsyncRasterization
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteCullRaster.cpp:48
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarNaniteEnableAsyncRasterization(
TEXT("r.Nanite.AsyncRasterization"),
1,
TEXT("If available, run Nanite compute rasterization as asynchronous compute."),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteCullRaster.cpp:4843
Scope (from outer to inner):
file
namespace Nanite
function FRasterContext InitRasterContext
Source code excerpt:
if (CVarNaniteComputeRasterization.GetValueOnRenderThread() != 0)
{
const bool bUseAsyncCompute = GSupportsEfficientAsyncCompute && (CVarNaniteEnableAsyncRasterization.GetValueOnRenderThread() != 0) && EnumHasAnyFlags(GRHIMultiPipelineMergeableAccessMask, ERHIAccess::UAVMask);
RasterContext.RasterScheduling = bUseAsyncCompute ? ERasterScheduling::HardwareAndSoftwareOverlap : ERasterScheduling::HardwareThenSoftware;
}
else
{
// Force hardware-only rasterization.
RasterContext.RasterScheduling = ERasterScheduling::HardwareOnly;