r.Nanite.ComputeRasterization

r.Nanite.ComputeRasterization

#Overview

name: r.Nanite.ComputeRasterization

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Nanite.ComputeRasterization is to control whether compute rasterization is allowed in Unreal Engine’s Nanite system. It is primarily used for the rendering system, specifically the Nanite geometry virtualization technology.

This setting variable is relied upon by Unreal Engine’s Renderer module, particularly within the Nanite subsystem. It’s referenced in the NaniteCullRaster.cpp file, which is part of the Nanite rendering pipeline.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1, meaning compute rasterization is enabled by default.

The associated variable CVarNaniteComputeRasterization directly interacts with r.Nanite.ComputeRasterization. They share the same value and purpose.

Developers must be aware that this variable affects the rasterization method used by Nanite. When enabled (set to 1), it allows compute rasterization. When disabled (set to 0), all rasterization will go through the hardware path.

Best practices when using this variable include:

  1. Understanding the performance implications of compute vs. hardware rasterization on your target platforms.
  2. Testing your game’s performance with both settings to determine which works best for your specific use case.
  3. Considering the interaction with other Nanite settings, such as async rasterization.

Regarding the associated variable CVarNaniteComputeRasterization:

#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:70

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarNaniteComputeRasterization(
	TEXT("r.Nanite.ComputeRasterization"),
	1,
	TEXT("Whether to allow compute rasterization. When disabled all rasterization will go through the hardware path."),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarNaniteProgrammableRaster(

#Associated Variable and Callsites

This variable is associated with another variable named CVarNaniteComputeRasterization. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteCullRaster.cpp:69

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarNaniteComputeRasterization(
	TEXT("r.Nanite.ComputeRasterization"),
	1,
	TEXT("Whether to allow compute rasterization. When disabled all rasterization will go through the hardware path."),
	ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Nanite/NaniteCullRaster.cpp:4841

Scope (from outer to inner):

file
namespace    Nanite
function     FRasterContext InitRasterContext

Source code excerpt:


	// Set rasterizer scheduling based on config and platform capabilities.
	if (CVarNaniteComputeRasterization.GetValueOnRenderThread() != 0)
	{
		const bool bUseAsyncCompute = GSupportsEfficientAsyncCompute && (CVarNaniteEnableAsyncRasterization.GetValueOnRenderThread() != 0) && EnumHasAnyFlags(GRHIMultiPipelineMergeableAccessMask, ERHIAccess::UAVMask);
		RasterContext.RasterScheduling = bUseAsyncCompute ? ERasterScheduling::HardwareAndSoftwareOverlap : ERasterScheduling::HardwareThenSoftware;
	}
	else
	{