r.ProfileGPU.ShowUI

r.ProfileGPU.ShowUI

#Overview

name: r.ProfileGPU.ShowUI

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.ShowUI is to control whether the user interface profiler should be displayed after profiling the GPU in Unreal Engine 5. This setting is part of the GPU profiling and performance analysis system.

Based on the details in the Callsites section, this setting variable is primarily used in the RHI (Rendering Hardware Interface) module of Unreal Engine. The RHI is a crucial part of the rendering system, providing an abstraction layer between the engine and various graphics APIs.

The value of this variable is set as a console variable with a default value of 1 (on). It can be changed at runtime through the console or configuration files.

This variable interacts closely with its associated variable GShowProfilerAfterProfilingGPUCVar. They share the same value and purpose. The GShowProfilerAfterProfilingGPUCVar is used in the ShouldShowProfilerAfterProfilingGPU() function to determine whether to display the profiler UI.

Developers should be aware that:

  1. This setting affects the visibility of the profiler UI, not the profiling process itself.
  2. Even when the UI is not shown (value set to 0), profiling results are still logged to the console and log files.
  3. This setting is marked as ECVF_RenderThreadSafe, meaning it can be safely changed from any thread.

Best practices when using this variable include:

  1. Leave it enabled (set to 1) during development and performance optimization phases.
  2. Consider disabling it (set to 0) for release builds or when you want to profile without the UI overhead.
  3. Use in conjunction with other profiling tools and settings for comprehensive performance analysis.

Regarding the associated variable GShowProfilerAfterProfilingGPUCVar:

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> GShowProfilerAfterProfilingGPUCVar(
	TEXT("r.ProfileGPU.ShowUI"),
	1,
	TEXT("Whether the user interface profiler should be displayed after profiling the GPU.\n")
	TEXT("The results will always go to the log/console\n")
	TEXT("0:off, 1:on (default)"),
	ECVF_RenderThreadSafe);
static TAutoConsoleVariable<float> GGPUHitchThresholdCVar(

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	TEXT("Whether a screenshot should be taken when profiling the GPU. 0:off, 1:on (default)"),
	ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> GShowProfilerAfterProfilingGPUCVar(
	TEXT("r.ProfileGPU.ShowUI"),
	1,
	TEXT("Whether the user interface profiler should be displayed after profiling the GPU.\n")
	TEXT("The results will always go to the log/console\n")
	TEXT("0:off, 1:on (default)"),
	ECVF_RenderThreadSafe);

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

Scope (from outer to inner):

file
namespace    RHIConfig
function     bool ShouldShowProfilerAfterProfilingGPU

Source code excerpt:

	bool ShouldShowProfilerAfterProfilingGPU()
	{
		return GShowProfilerAfterProfilingGPUCVar.GetValueOnAnyThread() != 0;
	}

	float GetGPUHitchThreshold()
	{
		return GGPUHitchThresholdCVar.GetValueOnAnyThread() * 0.001f;
	}