UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
RHIUtilities.cpp File Reference

Classes

class  FRHIFrameFlipTrackingRunnable
 
struct  FRHIFrameOffsetThread
 
struct  FRHIFrameOffsetThread::FFrameDebugInfo
 

Macros

#define USE_FRAME_OFFSET_THREAD   1
 

Functions

void SetDepthBoundsTest (FRHICommandList &RHICmdList, float WorldSpaceDepthNear, float WorldSpaceDepthFar, const FMatrix &ProjectionMatrix)
 
uint32 RHIGetSyncInterval ()
 
float RHIGetSyncSlackMS ()
 
bool RHIGetSyncAllowVariable ()
 
void RHIGetPresentThresholds (float &OutTopPercent, float &OutBottomPercent)
 
void RHITriggerTaskEventOnFlip (uint64 PresentIndex, const UE::Tasks::FTaskEvent &Event)
 
void RHISetFrameDebugInfo (uint64 PresentIndex, uint64 FrameIndex, uint64 InputTime)
 
void RHISetVsyncDebugInfo (FRHIFlipDetails &NewFlipFrame)
 
void RHIInitializeFlipTracking ()
 
void RHICalculateFrameTime ()
 
float RHIGetFrameTime ()
 
void RHIShutdownFlipTracking ()
 
ERHIAccess RHIGetDefaultResourceState (ETextureCreateFlags InUsage, bool bInHasInitialData)
 
ERHIAccess RHIGetDefaultResourceState (EBufferUsageFlags InUsage, bool bInHasInitialData)
 
void DecodeRenderTargetMode (ESimpleRenderTargetMode Mode, ERenderTargetLoadAction &ColorLoadAction, ERenderTargetStoreAction &ColorStoreAction, ERenderTargetLoadAction &DepthLoadAction, ERenderTargetStoreAction &DepthStoreAction, ERenderTargetLoadAction &StencilLoadAction, ERenderTargetStoreAction &StencilStoreAction, FExclusiveDepthStencil DepthStencilUsage)
 
EGpuVendorId RHIGetPreferredAdapterVendor ()
 

Variables

TAutoConsoleVariable< int32CVarRHISyncInterval (TEXT("rhi.SyncInterval"), 1, TEXT(" 3 - etc...\n"), ECVF_Default)
 
TAutoConsoleVariable< floatCVarRHIPresentThresholdTop (TEXT("rhi.PresentThreshold.Top"), 0.0f, TEXT("Range: 0.0 - 1.0\n"), ECVF_Default)
 
TAutoConsoleVariable< floatCVarRHIPresentThresholdBottom (TEXT("rhi.PresentThreshold.Bottom"), 0.0f, TEXT("Range: 0.0 - 1.0\n"), ECVF_Default)
 
TAutoConsoleVariable< int32CVarRHISyncAllowEarlyKick (TEXT("rhi.SyncAllowEarlyKick"), 1, TEXT("When 1, allows the RHI vsync thread to kick off the next frame early if we've missed the vsync."), ECVF_Default)
 
TAutoConsoleVariable< floatCVarRHISyncSlackMS (TEXT("rhi.SyncSlackMS"), 10, TEXT("Increases input latency by this many milliseconds, to help performance (trade-off tunable). Gamethread will be kicked off this many milliseconds before the vsync"), ECVF_Default)
 
TAutoConsoleVariable< int32CVarRHISyncAllowVariable (TEXT("rhi.SyncAllowVariable"), 1, TEXT("When 1, allows the RHI to use variable refresh rate, if supported by the output hardware."), ECVF_Default)
 
float GRHIFrameTimeMS = 0.0f
 
double GLastRHITimeInSeconds = 0.0
 
int32 GEnableConsole120Fps = 0
 
int32 InternalEnableConsole120Fps = 0
 

Macro Definition Documentation

◆ USE_FRAME_OFFSET_THREAD

#define USE_FRAME_OFFSET_THREAD   1

Function Documentation

◆ DecodeRenderTargetMode()

void DecodeRenderTargetMode ( ESimpleRenderTargetMode  Mode,
ERenderTargetLoadAction ColorLoadAction,
ERenderTargetStoreAction ColorStoreAction,
ERenderTargetLoadAction DepthLoadAction,
ERenderTargetStoreAction DepthStoreAction,
ERenderTargetLoadAction StencilLoadAction,
ERenderTargetStoreAction StencilStoreAction,
FExclusiveDepthStencil  DepthStencilUsage 
)

Convert the ESimpleRenderTargetMode into usable values

◆ RHICalculateFrameTime()

void RHICalculateFrameTime ( )

◆ RHIGetDefaultResourceState() [1/2]

RHI_API ERHIAccess RHIGetDefaultResourceState ( EBufferUsageFlags  InUsage,
bool  bInHasInitialData 
)

Get the best default resource state for the given buffer creation flags

◆ RHIGetDefaultResourceState() [2/2]

RHI_API ERHIAccess RHIGetDefaultResourceState ( ETextureCreateFlags  InUsage,
bool  bInHasInitialData 
)

Get the best default resource state for the given texture creation flags

◆ RHIGetFrameTime()

float RHIGetFrameTime ( )

Sets the FrameIndex and InputTime for the current frame.

◆ RHIGetPreferredAdapterVendor()

EGpuVendorId RHIGetPreferredAdapterVendor ( )

Returns the VendorID of the preferred vendor or -1 if none were specified.

◆ RHIGetPresentThresholds()

void RHIGetPresentThresholds ( float OutTopPercent,
float OutBottomPercent 
)

Returns the top and bottom vsync present thresholds (the values of rhi.PresentThreshold.Top and rhi.PresentThreshold.Bottom)

◆ RHIGetSyncAllowVariable()

bool RHIGetSyncAllowVariable ( )

Returns the value of the rhi.SyncAllowVariable CVar.

◆ RHIGetSyncInterval()

uint32 RHIGetSyncInterval ( )

Returns the value of the rhi.SyncInterval CVar.

◆ RHIGetSyncSlackMS()

float RHIGetSyncSlackMS ( )

Returns the value of the rhi.SyncSlackMS CVar or length of a full frame interval if the frame offset system is disabled.

◆ RHIInitializeFlipTracking()

void RHIInitializeFlipTracking ( )

◆ RHISetFrameDebugInfo()

void RHISetFrameDebugInfo ( uint64  PresentIndex,
uint64  FrameIndex,
uint64  InputTime 
)

Sets the FrameIndex and InputTime for the current frame.

◆ RHISetVsyncDebugInfo()

void RHISetVsyncDebugInfo ( FRHIFlipDetails NewFlipFrame)

Sets the Vsync information for a new frame

◆ RHIShutdownFlipTracking()

void RHIShutdownFlipTracking ( )

◆ RHITriggerTaskEventOnFlip()

void RHITriggerTaskEventOnFlip ( uint64  PresentIndex,
const UE::Tasks::FTaskEvent Event 
)

◆ SetDepthBoundsTest()

void SetDepthBoundsTest ( FRHICommandList RHICmdList,
float  WorldSpaceDepthNear,
float  WorldSpaceDepthFar,
const FMatrix ProjectionMatrix 
)

Variable Documentation

◆ CVarRHIPresentThresholdBottom

TAutoConsoleVariable< float > CVarRHIPresentThresholdBottom(TEXT("rhi.PresentThreshold.Bottom"), 0.0f, TEXT("Range: 0.0 - 1.0\n"), ECVF_Default) ( TEXT("rhi.PresentThreshold.Bottom")  ,
0.  0f,
TEXT("Range: 0.0 - 1.0\n" ,
ECVF_Default   
)

◆ CVarRHIPresentThresholdTop

TAutoConsoleVariable< float > CVarRHIPresentThresholdTop(TEXT("rhi.PresentThreshold.Top"), 0.0f, TEXT("Range: 0.0 - 1.0\n"), ECVF_Default) ( TEXT("rhi.PresentThreshold.Top")  ,
0.  0f,
TEXT("Range: 0.0 - 1.0\n" ,
ECVF_Default   
)

◆ CVarRHISyncAllowEarlyKick

TAutoConsoleVariable< int32 > CVarRHISyncAllowEarlyKick(TEXT("rhi.SyncAllowEarlyKick"), 1, TEXT("When 1, allows the RHI vsync thread to kick off the next frame early if we've missed the vsync."), ECVF_Default) ( TEXT("rhi.SyncAllowEarlyKick")  ,
,
TEXT("When 1, allows the RHI vsync thread to kick off the next frame early if we've missed the vsync." ,
ECVF_Default   
)

◆ CVarRHISyncAllowVariable

TAutoConsoleVariable< int32 > CVarRHISyncAllowVariable(TEXT("rhi.SyncAllowVariable"), 1, TEXT("When 1, allows the RHI to use variable refresh rate, if supported by the output hardware."), ECVF_Default) ( TEXT("rhi.SyncAllowVariable")  ,
,
TEXT("When 1, allows the RHI to use variable refresh rate, if supported by the output hardware." ,
ECVF_Default   
)

◆ CVarRHISyncInterval

TAutoConsoleVariable< int32 > CVarRHISyncInterval(TEXT("rhi.SyncInterval"), 1, TEXT(" 3 - etc...\n"), ECVF_Default) ( TEXT("rhi.SyncInterval")  ,
,
TEXT(" 3 - etc...\n")  ,
ECVF_Default   
)

◆ CVarRHISyncSlackMS

TAutoConsoleVariable< float > CVarRHISyncSlackMS(TEXT("rhi.SyncSlackMS"), 10, TEXT("Increases input latency by this many milliseconds, to help performance (trade-off tunable). Gamethread will be kicked off this many milliseconds before the vsync"), ECVF_Default) ( TEXT("rhi.SyncSlackMS")  ,
10  ,
TEXT("Increases input latency by this many milliseconds, to help performance (trade-off tunable). Gamethread will be kicked off this many milliseconds before the vsync" ,
ECVF_Default   
)

◆ GEnableConsole120Fps

int32 GEnableConsole120Fps = 0

◆ GLastRHITimeInSeconds

double GLastRHITimeInSeconds = 0.0

◆ GRHIFrameTimeMS

float GRHIFrameTimeMS = 0.0f

◆ InternalEnableConsole120Fps

int32 InternalEnableConsole120Fps = 0