RHI.GPUHitchThreshold
RHI.GPUHitchThreshold
#Overview
name: RHI.GPUHitchThreshold
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Threshold for detecting hitches on the GPU (in milliseconds).
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of RHI.GPUHitchThreshold is to set a threshold for detecting hitches on the GPU. It is used in the rendering system, specifically within the RHI (Rendering Hardware Interface) subsystem of Unreal Engine 5.
This setting variable is primarily relied upon by the RHI module, which is a core part of Unreal Engine’s rendering system. It’s used to identify performance issues related to GPU processing.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 100.0f milliseconds, but can be changed at runtime through console commands or configuration files.
The associated variable GGPUHitchThresholdCVar interacts directly with RHI.GPUHitchThreshold. This is the actual TAutoConsoleVariable object that stores and manages the threshold value.
Developers must be aware that this threshold is in milliseconds. When using this variable, they should consider the target frame rate of their application and set the threshold accordingly. A lower threshold will be more sensitive to hitches but may also produce more false positives.
Best practices when using this variable include:
- Adjusting the threshold based on the specific needs of the project and target hardware.
- Using it in conjunction with other performance monitoring tools to get a comprehensive view of GPU performance.
- Being cautious about setting the threshold too low, as it may lead to excessive logging or false alarms.
Regarding the associated variable GGPUHitchThresholdCVar:
- Its purpose is to provide a runtime-configurable way to set and access the GPU hitch threshold.
- It’s used within the RHI module to retrieve the current threshold value.
- The value is set through the console variable system, allowing for dynamic adjustments during development or even at runtime.
- It’s accessed through the GetValueOnAnyThread() method, which suggests it’s designed to be thread-safe.
- Developers should be aware that when the value is retrieved (in the GetGPUHitchThreshold() function), it’s converted from milliseconds to seconds by multiplying by 0.001f.
- Best practices include using the provided RHIConfig::GetGPUHitchThreshold() function to access the value, ensuring consistent units and thread-safe access across the engine.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/RHI.cpp:1105
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<float> GGPUHitchThresholdCVar(
TEXT("RHI.GPUHitchThreshold"),
100.0f,
TEXT("Threshold for detecting hitches on the GPU (in milliseconds).")
);
static TAutoConsoleVariable<int32> GCVarRHIRenderPass(
TEXT("r.RHIRenderPasses"),
0,
#Associated Variable and Callsites
This variable is associated with another variable named GGPUHitchThresholdCVar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/RHI.cpp:1104
Scope: file
Source code excerpt:
TEXT("0:off, 1:on (default)"),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<float> GGPUHitchThresholdCVar(
TEXT("RHI.GPUHitchThreshold"),
100.0f,
TEXT("Threshold for detecting hitches on the GPU (in milliseconds).")
);
static TAutoConsoleVariable<int32> GCVarRHIRenderPass(
TEXT("r.RHIRenderPasses"),
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/RHI.cpp:1303
Scope (from outer to inner):
file
namespace RHIConfig
function float GetGPUHitchThreshold
Source code excerpt:
float GetGPUHitchThreshold()
{
return GGPUHitchThresholdCVar.GetValueOnAnyThread() * 0.001f;
}
}
// By default, read only states and UAV states are allowed to participate in state merging.
ERHIAccess GRHIMergeableAccessMask = ERHIAccess::ReadOnlyMask | ERHIAccess::UAVMask;