r.Nanite.RasterSetupTask
r.Nanite.RasterSetupTask
#Overview
name: r.Nanite.RasterSetupTask
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Nanite.RasterSetupTask is to control the setup task for Nanite rasterization. Nanite is Unreal Engine 5’s virtualized geometry system, and this variable specifically affects how the rasterization setup is performed.
This setting variable is primarily used by the Nanite rendering system, which is part of Unreal Engine’s renderer module. Based on the callsites, it’s clear that this variable is utilized within the Nanite namespace and specifically in the NaniteCullRaster.cpp file.
The value of this variable is set as a console variable with a default value of 1. It’s defined using the TAutoConsoleVariable template, which allows it to be changed at runtime through console commands.
The associated variable CVarNaniteRasterSetupTask interacts directly with r.Nanite.RasterSetupTask. They share the same value and are used interchangeably in the code.
Developers should be aware that this variable affects the behavior of the Nanite rasterization setup process. When the value is greater than 0, it enables the raster setup task to run as a separate task with normal priority.
Best practices when using this variable include:
- Understanding the performance implications of enabling or disabling the raster setup task.
- Testing different values to find the optimal setting for your specific use case.
- Being cautious when changing this value at runtime, as it may affect rendering performance.
Regarding the associated variable CVarNaniteRasterSetupTask:
The purpose of CVarNaniteRasterSetupTask is to provide a programmatic way to access and modify the r.Nanite.RasterSetupTask setting within the C++ code.
This variable is used directly in the Nanite renderer code, specifically in the FRenderer::PrepareRasterizerPasses function.
The value of CVarNaniteRasterSetupTask is set when r.Nanite.RasterSetupTask is modified, as they are linked through the TAutoConsoleVariable mechanism.
CVarNaniteRasterSetupTask interacts with the task system of Unreal Engine, determining whether the raster setup should be performed as a separate task.
Developers should be aware that this variable is accessed on the render thread (GetValueOnRenderThread()), which is important for thread safety.
Best practices for using CVarNaniteRasterSetupTask include:
- Always accessing it on the render thread to avoid race conditions.
- Using it in conjunction with other Nanite-related settings for optimal performance tuning.
- Considering its impact on the overall rendering pipeline when modifying its value.
#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:125
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarNaniteRasterSetupTask(
TEXT("r.Nanite.RasterSetupTask"),
1,
TEXT(""),
ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarNaniteRasterSetupCache(
#Associated Variable and Callsites
This variable is associated with another variable named CVarNaniteRasterSetupTask
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteCullRaster.cpp:124
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarNaniteRasterSetupTask(
TEXT("r.Nanite.RasterSetupTask"),
1,
TEXT(""),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteCullRaster.cpp:4268
Scope (from outer to inner):
file
namespace Nanite
function void FRenderer::PrepareRasterizerPasses
Source code excerpt:
GetVisibilityTask(VisibilityQuery),
UE::Tasks::ETaskPriority::Normal,
CVarNaniteRasterSetupTask.GetValueOnRenderThread() > 0
);
// Create raster in meta buffer (now that the setup task has completed populating the source memory)
if (RasterBinCount > 0)
{
Context.MetaBuffer = CreateStructuredBuffer(