rhi.PresentThreshold.Bottom
rhi.PresentThreshold.Bottom
#Overview
name: rhi.PresentThreshold.Bottom
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Specifies the percentage of the screen from the bottom where tearing is allowed.\nOnly effective on supported platforms.\nRange: 0.0 - 1.0\n
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of rhi.PresentThreshold.Bottom is to specify the percentage of the screen from the bottom where tearing is allowed during rendering. This setting is part of the Rendering Hardware Interface (RHI) system in Unreal Engine 5.
This setting variable is primarily used by the RHI subsystem, which is responsible for interfacing between the engine and the graphics hardware. It’s particularly relevant for managing vertical synchronization (vsync) and screen tearing.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 0.0f and can be changed at runtime through console commands or programmatically.
The rhi.PresentThreshold.Bottom variable interacts closely with another variable called rhi.PresentThreshold.Top. Together, these two variables define a region of the screen where tearing is allowed. They are often used in tandem to control the vsync behavior of the rendering system.
Developers must be aware that this setting is only effective on supported platforms. The valid range for this variable is between 0.0 and 1.0, representing the percentage of the screen height from the bottom.
Best practices when using this variable include:
- Ensuring the value is within the valid range (0.0 to 1.0).
- Considering the balance between this value and rhi.PresentThreshold.Top to create an appropriate tearing-allowed region.
- Testing on various supported platforms to ensure the desired effect is achieved.
- Using in conjunction with other vsync and frame pacing settings for optimal rendering performance.
The associated variable CVarRHIPresentThresholdBottom is the actual CVar object that controls the rhi.PresentThreshold.Bottom setting. It’s defined in the RHI module and is used to get and set the value of rhi.PresentThreshold.Bottom.
The purpose of CVarRHIPresentThresholdBottom is to provide a programmatic interface for manipulating the rhi.PresentThreshold.Bottom setting. It’s used internally by the engine to retrieve the current value of the setting and apply it to the rendering process.
This variable is part of the RHI subsystem and is primarily used in the RHIUtilities module. It’s typically accessed through helper functions like RHIGetPresentThresholds, which retrieves both the top and bottom threshold values.
The value of CVarRHIPresentThresholdBottom is set when the CVar is initialized, but it can be changed at runtime through console commands or programmatically using the CVar API.
Developers should be aware that when using CVarRHIPresentThresholdBottom, the value is clamped between 0.0 and 1.0 when retrieved through RHIGetPresentThresholds. This ensures that the value always remains within the valid range.
Best practices for using CVarRHIPresentThresholdBottom include:
- Using the appropriate RHI utility functions (like RHIGetPresentThresholds) to access the value, ensuring proper clamping and thread-safety.
- Being cautious when directly modifying the CVar value, as it could affect the rendering behavior across the entire application.
- Considering performance implications when frequently accessing or modifying this value, especially in performance-critical code paths.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/RHIUtilities.cpp:96
Scope: file
Source code excerpt:
TAutoConsoleVariable<float> CVarRHIPresentThresholdBottom(
TEXT("rhi.PresentThreshold.Bottom"),
0.0f,
TEXT("Specifies the percentage of the screen from the bottom where tearing is allowed.\n")
TEXT("Only effective on supported platforms.\n")
TEXT("Range: 0.0 - 1.0\n"),
ECVF_Default
);
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Public/RHIUtilities.h:621
Scope: file
Source code excerpt:
extern RHI_API float RHIGetSyncSlackMS();
/** Returns the top and bottom vsync present thresholds (the values of rhi.PresentThreshold.Top and rhi.PresentThreshold.Bottom) */
extern RHI_API void RHIGetPresentThresholds(float& OutTopPercent, float& OutBottomPercent);
/** Returns the value of the rhi.SyncAllowVariable CVar. */
extern RHI_API bool RHIGetSyncAllowVariable();
/** Signals the completion of the specified task graph event when the given frame has flipped. */
#Associated Variable and Callsites
This variable is associated with another variable named CVarRHIPresentThresholdBottom
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/RHIUtilities.cpp:95
Scope: file
Source code excerpt:
);
TAutoConsoleVariable<float> CVarRHIPresentThresholdBottom(
TEXT("rhi.PresentThreshold.Bottom"),
0.0f,
TEXT("Specifies the percentage of the screen from the bottom where tearing is allowed.\n")
TEXT("Only effective on supported platforms.\n")
TEXT("Range: 0.0 - 1.0\n"),
ECVF_Default
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/RHIUtilities.cpp:537
Scope (from outer to inner):
file
function void RHIGetPresentThresholds
Source code excerpt:
{
OutTopPercent = FMath::Clamp(CVarRHIPresentThresholdTop.GetValueOnAnyThread(), 0.0f, 1.0f);
OutBottomPercent = FMath::Clamp(CVarRHIPresentThresholdBottom.GetValueOnAnyThread(), 0.0f, 1.0f);
}
void RHITriggerTaskEventOnFlip(uint64 PresentIndex, const UE::Tasks::FTaskEvent& Event)
{
FRHIFrameFlipTrackingRunnable::TriggerTaskEventOnFlip(PresentIndex, Event);
}