r.Nanite.ProgrammableRaster

r.Nanite.ProgrammableRaster

#Overview

name: r.Nanite.ProgrammableRaster

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.ProgrammableRaster is to control whether programmable rasterization is allowed in the Nanite system, which is a part of Unreal Engine 5’s rendering technology.

This setting variable is primarily used by the Nanite subsystem within Unreal Engine’s rendering module. Based on the callsites, it’s clear that this variable is utilized in the NaniteCullRaster.cpp file, which is part of the Renderer module.

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

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

Developers must be aware that this variable is experimental and heavily work-in-progress, as indicated by the comment “NOTE: Heavily WIP and experimental - do not use!” This suggests that the feature might not be stable or fully implemented yet.

Best practices when using this variable include:

  1. Be cautious about using it in production environments due to its experimental nature.
  2. When disabled (set to 0), all rasterization will go through the fixed function path, which might affect performance or visual quality.
  3. Monitor performance and visual quality when toggling this setting, as it may have significant impacts on the rendering pipeline.

Regarding the associated variable CVarNaniteProgrammableRaster:

Developers should be aware that changing this variable at runtime could have immediate effects on the rendering pipeline, potentially affecting performance or visual output. As with the main variable, caution should be exercised when using this in production environments due to its experimental nature.

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarNaniteProgrammableRaster(
	TEXT("r.Nanite.ProgrammableRaster"),
	1,
	TEXT("Whether to allow programmable raster. When disabled all rasterization will go through the fixed function path."),
	ECVF_RenderThreadSafe
);

// NOTE: Heavily WIP and experimental - do not use!

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarNaniteProgrammableRaster(
	TEXT("r.Nanite.ProgrammableRaster"),
	1,
	TEXT("Whether to allow programmable raster. When disabled all rasterization will go through the fixed function path."),
	ECVF_RenderThreadSafe
);

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

Scope (from outer to inner):

file
namespace    Nanite
function     FRenderer::FRenderer

Source code excerpt:

	}

	if (CVarNaniteProgrammableRaster.GetValueOnRenderThread() == 0)
	{
		Configuration.bDisableProgrammable = true;
	}

	RenderFlags |= Configuration.bDisableProgrammable	? NANITE_RENDER_FLAG_DISABLE_PROGRAMMABLE : 0u;
	RenderFlags |= Configuration.bForceHWRaster			? NANITE_RENDER_FLAG_FORCE_HW_RASTER : 0u;