r.ProfileGPU.ShowLeafEvents

r.ProfileGPU.ShowLeafEvents

#Overview

name: r.ProfileGPU.ShowLeafEvents

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.ProfileGPU.ShowLeafEvents is to control the display of event-only leaf nodes with no associated draws in the GPU profiler. This setting variable is part of Unreal Engine’s GPU profiling and performance analysis system.

This setting variable is primarily used in the RHI (Rendering Hardware Interface) module of Unreal Engine, specifically within the GPU profiler subsystem. It affects how detailed information is presented during GPU profiling sessions.

The value of this variable is set through a console variable system, allowing it to be changed at runtime. It is initialized with a default value of 1, meaning it’s enabled by default.

The associated variable GProfileGPUShowEvents directly interacts with r.ProfileGPU.ShowLeafEvents. They share the same value and purpose.

Developers must be aware that enabling this variable (set to 1) will cause the GPU profiler to display more detailed information, including event-only leaf nodes that don’t have associated draw calls. This can be useful for debugging and performance analysis but may also increase the amount of data to process and display.

Best practices when using this variable include:

  1. Enable it when you need to investigate detailed GPU event hierarchies, especially when troubleshooting performance issues related to non-drawing operations.
  2. Disable it (set to 0) when you want to focus only on nodes with actual draw calls, which can help reduce noise in the profiling data.
  3. Use it in conjunction with other profiling tools and variables to get a comprehensive view of GPU performance.

Regarding the associated variable GProfileGPUShowEvents:

The purpose of GProfileGPUShowEvents is the same as r.ProfileGPU.ShowLeafEvents. It’s an internal representation of the console variable within the engine’s C++ code.

This variable is used directly in the GPU profiler’s implementation, specifically in the FGPUProfileStatSummary constructor, where it determines whether event leaf nodes should be dumped or not.

The value of GProfileGPUShowEvents is set based on the console variable r.ProfileGPU.ShowLeafEvents. It’s accessed using the GetValueOnRenderThread() method, ensuring thread-safe access to the current value.

Developers should be aware that changes to r.ProfileGPU.ShowLeafEvents will be reflected in GProfileGPUShowEvents, and this will affect the behavior of the GPU profiler at runtime.

Best practices for GProfileGPUShowEvents align with those for r.ProfileGPU.ShowLeafEvents, as they are essentially two sides of the same coin - one being the console-accessible variable and the other being its internal C++ representation.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/GPUProfiler.cpp:46

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> GProfileGPUShowEvents(
	TEXT("r.ProfileGPU.ShowLeafEvents"),
	1,
	TEXT("Allows profileGPU to display event-only leaf nodes with no draws associated."),
	ECVF_Default);

static TAutoConsoleVariable<int32> GProfileGPUTransitions(
	TEXT("r.ProfileGPU.ShowTransitions"),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/GPUProfiler.cpp:45

Scope: file

Source code excerpt:

	ECVF_Default);

static TAutoConsoleVariable<int32> GProfileGPUShowEvents(
	TEXT("r.ProfileGPU.ShowLeafEvents"),
	1,
	TEXT("Allows profileGPU to display event-only leaf nodes with no draws associated."),
	ECVF_Default);

static TAutoConsoleVariable<int32> GProfileGPUTransitions(

#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/GPUProfiler.cpp:199

Scope (from outer to inner):

file
function     FGPUProfileStatSummary

Source code excerpt:

		, bDumpEventLeafNodes(false)
	{
		bDumpEventLeafNodes = GProfileGPUShowEvents.GetValueOnRenderThread() != 0;
		bGatherSummaryStats = GProfilePrintAssetSummary.GetValueOnRenderThread() != 0;
	}

	void ProcessMatch(FGPUProfilerEventNode* Node)
	{
		if (bGatherSummaryStats && (Node->NumTotalPrimitives > 0) && (Node->NumTotalVertices > 0) && (Node->Children.Num() == 0))