r.ProfileGPU.Screenshot
r.ProfileGPU.Screenshot
#Overview
name: r.ProfileGPU.Screenshot
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether a screenshot should be taken when profiling the GPU. 0:off, 1:on (default)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.ProfileGPU.Screenshot is to control whether a screenshot should be taken when profiling the GPU in Unreal Engine 5. It is a rendering-related setting that affects the GPU profiling process.
This setting variable is primarily used by the RHI (Rendering Hardware Interface) subsystem of Unreal Engine. It’s defined in the RHI module, specifically in the RHI.cpp file.
The value of this variable is set using a console variable system. It’s initialized with a default value of 1 (on) but can be changed at runtime through the console or configuration files.
The associated variable GSaveScreenshotAfterProfilingGPUCVar interacts directly with r.ProfileGPU.Screenshot. It’s a TAutoConsoleVariable
Developers should be aware that:
- This setting is render thread safe (ECVF_RenderThreadSafe).
- It’s a binary setting: 0 for off, any non-zero value (default 1) for on.
- The setting affects performance profiling workflows, not regular gameplay or rendering.
Best practices when using this variable include:
- Leave it on (default) during development to capture visual state along with performance data.
- Consider turning it off if you’re doing repeated profiling runs and don’t need the visual information, as it might slightly impact performance or storage.
- Use in conjunction with other profiling tools and settings for a comprehensive performance analysis.
Regarding the associated variable GSaveScreenshotAfterProfilingGPUCVar:
- It’s the actual storage for the r.ProfileGPU.Screenshot setting.
- It’s accessed through the RHIConfig::ShouldSaveScreenshotAfterProfilingGPU() function, which returns true if the value is non-zero.
- This function is likely called by the GPU profiling system to determine whether to capture a screenshot after profiling.
- Developers typically won’t interact with this variable directly, instead using the r.ProfileGPU.Screenshot console variable or the RHIConfig::ShouldSaveScreenshotAfterProfilingGPU() function.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/RHI.cpp:1093
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> GSaveScreenshotAfterProfilingGPUCVar(
TEXT("r.ProfileGPU.Screenshot"),
1,
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,
#Associated Variable and Callsites
This variable is associated with another variable named GSaveScreenshotAfterProfilingGPUCVar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/RHI.cpp:1092
Scope: file
Source code excerpt:
TEXT("If 1, the RHI will cache resource table contents within a frame. Otherwise resource tables are rebuilt for every draw call.")
);
static TAutoConsoleVariable<int32> GSaveScreenshotAfterProfilingGPUCVar(
TEXT("r.ProfileGPU.Screenshot"),
1,
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"),
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/RHI.cpp:1293
Scope (from outer to inner):
file
namespace RHIConfig
function bool ShouldSaveScreenshotAfterProfilingGPU
Source code excerpt:
bool ShouldSaveScreenshotAfterProfilingGPU()
{
return GSaveScreenshotAfterProfilingGPUCVar.GetValueOnAnyThread() != 0;
}
bool ShouldShowProfilerAfterProfilingGPU()
{
return GShowProfilerAfterProfilingGPUCVar.GetValueOnAnyThread() != 0;
}