r.PathTracing.Compaction

r.PathTracing.Compaction

#Overview

name: r.PathTracing.Compaction

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.PathTracing.Compaction is to enable path compaction in the path tracing system of Unreal Engine 5’s rendering pipeline. This setting is designed to improve GPU occupancy for the path tracer.

Regarding the associated variable CVarPathTracingCompaction:

The purpose of CVarPathTracingCompaction is to provide programmatic access to the r.PathTracing.Compaction setting within the engine’s C++ code.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:46

Scope: file

Source code excerpt:


TAutoConsoleVariable<int32> CVarPathTracingCompaction(
	TEXT("r.PathTracing.Compaction"),
	1,
	TEXT("Enables path compaction to improve GPU occupancy for the path tracer (default: 1 (enabled))"),
	ECVF_RenderThreadSafe
);

TAutoConsoleVariable<int32> CVarPathTracingIndirectDispatch(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:45

Scope: file

Source code excerpt:



TAutoConsoleVariable<int32> CVarPathTracingCompaction(
	TEXT("r.PathTracing.Compaction"),
	1,
	TEXT("Enables path compaction to improve GPU occupancy for the path tracer (default: 1 (enabled))"),
	ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:2303

Scope (from outer to inner):

file
function     static FPathTracingRG::FPermutationDomain GetPathTracingRGPermutation

Source code excerpt:

{
	const bool bUseExperimental = CVarPathTracingExperimental.GetValueOnRenderThread() != 0;
	const bool bUseCompaction = (bUseExperimental == false) || CVarPathTracingCompaction.GetValueOnRenderThread() != 0;
	const bool bUseAdaptiveSampling = bUseExperimental && CVarPathTracingAdaptiveSampling.GetValueOnRenderThread() != 0;
	const bool bHasComplexSpecialRenderPath = Substrate::IsSubstrateEnabled() && Scene.SubstrateSceneData.bUsesComplexSpecialRenderPath;

	FPathTracingRG::FPermutationDomain Out;
	Out.Set<FPathTracingRG::FCompactionType>(bUseCompaction);
	Out.Set<FPathTracingRG::FAdaptiveSampling>(bUseAdaptiveSampling);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:2787

Scope: file

Source code excerpt:


			// should we use path compaction?
			const bool bUseCompaction = (bUseExperimental == false) || CVarPathTracingCompaction.GetValueOnRenderThread() != 0;
			const bool bUseIndirectDispatch = GRHISupportsRayTracingDispatchIndirect && CVarPathTracingIndirectDispatch.GetValueOnRenderThread() != 0;
			const int FlushRenderingCommands = CVarPathTracingFlushDispatch.GetValueOnRenderThread();

			FRDGBuffer* ActivePaths[2] = {};
			FRDGBuffer* NumActivePaths[2] = {};
			FRDGBuffer* PathStateData = nullptr;