![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include "RenderingThread.h"#include "HAL/Runnable.h"#include "HAL/RunnableThread.h"#include "HAL/ExceptionHandling.h"#include "HAL/PlatformApplicationMisc.h"#include "Misc/App.h"#include "Misc/CommandLine.h"#include "Misc/OutputDeviceRedirector.h"#include "Misc/CoreStats.h"#include "Misc/TimeGuard.h"#include "Misc/CoreDelegates.h"#include "Misc/ScopeLock.h"#include "RHI.h"#include "RenderCore.h"#include "RenderCommandFence.h"#include "RenderDeferredCleanup.h"#include "TickableObjectRenderThread.h"#include "Stats/StatsSystem.h"#include "Stats/StatsData.h"#include "HAL/ThreadHeartBeat.h"#include "RenderResource.h"#include "RHIUtilities.h"#include "HAL/LowLevelMemTracker.h"#include "ProfilingDebugging/MiscTrace.h"#include "ProfilingDebugging/CsvProfiler.h"#include "Async/TaskTrace.h"#include "DataDrivenShaderPlatformInfo.h"#include "HAL/ThreadManager.h"#include "ProfilingDebugging/CountersTrace.h"#include "Async/ParallelFor.h"Classes | |
| class | FRHIThread |
| class | FRenderingThread |
| struct | FSuspendRenderingTickables |
| class | FRenderingThreadTickHeartbeat |
| struct | FConsoleRenderThreadPropagation |
| struct | FRenderCommandFenceBundlerState |
| class | FRenderCommandPipeRegistry |
Namespaces | |
| namespace | UE |
| namespace | UE::RenderCommandPipe |
| namespace | FFrameEndSync |
Macros | |
| #define | UE_RENDER_COMMAND_FENCE_BUNDLER_REGION TEXT("Render Command Fence Bundler") |
| #define | UE_RENDER_COMMAND_PIPE_RECORD_REGION TEXT("Render Command Pipe Recording") |
| #define | UE_RENDER_COMMAND_PIPE_SYNC_REGION TEXT("Render Command Pipe Synced") |
| #define | UE_RENDER_COMMAND_BEGIN_REGION(Region) |
| #define | UE_RENDER_COMMAND_END_REGION(Region) |
| #define UE_RENDER_COMMAND_BEGIN_REGION | ( | Region | ) |
| #define UE_RENDER_COMMAND_END_REGION | ( | Region | ) |
| #define UE_RENDER_COMMAND_PIPE_RECORD_REGION TEXT("Render Command Pipe Recording") |
| void AdvanceRenderingThreadStatsGT | ( | bool | bDiscardCallstack, |
| int64 | StatsFrame, | ||
| int32 | DisableChangeTagStartFrame | ||
| ) |
Advances stats for the rendering thread. Called from the game thread.
| void BeginCleanup | ( | FDeferredCleanupInterface * | CleanupObject | ) |
Adds the specified deferred cleanup object to the current set of pending cleanup objects.
| void CheckRenderingThreadHealth | ( | ) |
Checks if the rendering thread is healthy and running. If it has crashed, UE_LOG is called with the exception information.
| DECLARE_CYCLE_STAT | ( | TEXT("Frame Sync Time") | , |
| STAT_FrameSyncTime | , | ||
| STATGROUP_RenderThreadProcessing | |||
| ) |
| DECLARE_RENDER_COMMAND_TAG | ( | FRenderCommandTag_ExecuteCommandLists | , |
| ExecuteCommandLists | |||
| ) |
| void FlushPendingDeleteRHIResources_GameThread | ( | ) |
| void FlushPendingDeleteRHIResources_RenderThread | ( | ) |
| void FlushRenderCommandFenceBundler | ( | ) |
| void FlushRenderingCommands | ( | ) |
Waits for the rendering thread to finish executing all pending rendering commands. Should only be used from the game thread.
| FRHICommandListImmediate & GetImmediateCommandList_ForRenderCommand | ( | ) |
| FPendingCleanupObjects * GetPendingCleanupObjects | ( | ) |
Transfers ownership of the current set of pending cleanup objects to the caller. A new set is created for subsequent BeginCleanup calls.
|
inline |
| RENDERCORE_API TAtomic< bool > GMainThreadBlockedOnRenderThread | ( | false | ) |
|
inline |
| RENDERCORE_API void InitRenderingThread | ( | ) |
| bool IsRenderingThreadHealthy | ( | ) |
Checks if the rendering thread is healthy and running, without crashing
| bool IsRenderThreadTimeoutSuspended | ( | ) |
| RENDERCORE_API void LatchRenderThreadConfiguration | ( | ) |
| FDelegateHandle RegisterStopRenderingThreadDelegate | ( | const FStopRenderingThread::FDelegate & | InDelegate | ) |
| void ResumeRenderThreadTimeout | ( | ) |
| RENDERCORE_API void ShutdownRenderingThread | ( | ) |
| void StartRenderCommandFenceBundler | ( | ) |
| void StopRenderCommandFenceBundler | ( | ) |
| void SuspendRenderThreadTimeout | ( | ) |
| UE_TRACE_CHANNEL_DEFINE | ( | RenderCommandsChannel | ) |
| void UnregisterStopRenderingThreadDelegate | ( | FDelegateHandle | InDelegateHandle | ) |
| TAutoConsoleVariable< int32 > CVarAllowOneFrameThreadLag(TEXT("r.OneFrameThreadLag"), 1,) | ( | TEXT("r.OneFrameThreadLag") | , |
| 1 | |||
| ) |
| TAutoConsoleVariable< int32 > CVarGTSyncType(TEXT("r.GTSyncType"), 0, TEXT(" <= 0 - Sync the game thread with the N-1 render thread frame. Then sync with the N-m RHI thread frame where m is (2 + (-r.GTSyncType)) (i.e. negative values increase the amount of RHI thread overlap) (default = 0).\n") TEXT(" 2 - Sync the game thread with the GPU swap chain flip (only on supported platforms).\n"), ECVF_Default) | ( | TEXT("r.GTSyncType") | , |
| 0 | , | ||
| TEXT(" <= 0 - Sync the game thread with the N-1 render thread frame. Then sync with the N-m RHI thread frame where m is (2 + (-r.GTSyncType)) (i.e. negative values increase the amount of RHI thread overlap) (default = 0).\n") TEXT(" 2 - Sync the game thread with the GPU swap chain flip (only on supported platforms).\n") | , | ||
| ECVF_Default | |||
| ) |
| FAutoConsoleVariableRef CVarRenderCommandFenceBundling(TEXT("r.RenderCommandFenceBundling"), GRenderCommandFenceBundling, TEXT(" 1: enabled (default);\n"), ECVF_Default) | ( | TEXT("r.RenderCommandFenceBundling") | , |
| GRenderCommandFenceBundling | , | ||
| TEXT(" 1: enabled (default);\n") | , | ||
| ECVF_Default | |||
| ) |
| FAutoConsoleVariable CVarRenderCommandPipeMode(TEXT("r.RenderCommandPipeMode"), 2, TEXT(" 2: Render commands are enqueued into a render command pipe for all declared pipes.;\n"), FConsoleVariableDelegate::CreateLambda([](IConsoleVariable *Variable) { UE::RenderCommandPipe::StopRecording(); GRenderCommandPipeMode=GetValidatedRenderCommandPipeMode(Variable->GetInt()); })) | ( | TEXT("r.RenderCommandPipeMode") | , |
| 2 | , | ||
| TEXT(" 2: Render commands are enqueued into a render command pipe for all declared pipes.;\n") | , | ||
| FConsoleVariableDelegate::CreateLambda([](IConsoleVariable *Variable) { UE::RenderCommandPipe::StopRecording(); GRenderCommandPipeMode=GetValidatedRenderCommandPipeMode(Variable->GetInt());}) | |||
| ) |
| uint32 GGameThreadTime = 0 |
How many cycles the gamethread used (excluding idle time). It's set once per frame in FViewport::Draw.
| uint32 GGameThreadTimeCriticalPath = 0 |
How many cycles the gamethread used, including dependent wait time.
| uint32 GGameThreadWaitTime = 0 |
How much idle time on the game thread. It's set once per frame in FViewport::Draw.
Polled by the game thread to detect crashes in the rendering thread. If the rendering thread crashes, it sets this variable to false.
| RENDERCORE_API bool GIsThreadedRendering = false |
Whether the renderer is currently running in a separate thread. If this is false, then all rendering commands will be executed immediately instead of being enqueued in the rendering command buffer.
| RENDERCORE_API TOptional<bool> GPendingUseThreadedRendering |
| ERenderCommandPipeMode GRenderCommandPipeMode = ERenderCommandPipeMode::None |
| FString GRenderingThreadError |
If the rendering thread has been terminated by an unhandled exception, this contains the error message.
| FRunnableThread* GRenderingThreadHeartbeat = NULL |
| float GRenderingThreadMaxIdleTickFrequency = 40.f |
Maximum rate the rendering thread will tick tickables when idle (in Hz)
| uint32 GRenderThreadTime = 0 |
How many cycles the renderthread used (excluding idle time). It's set once per frame in FViewport::Draw.
| uint32 GRenderThreadTimeCriticalPath = 0 |
How many cycles the renderthread used, including dependent wait time.
| uint32 GRenderThreadWaitTime = 0 |
How many cycles of wait time renderthread used. It's set once per frame in FViewport::Draw.
| FRHIThread* GRHIThread = nullptr |
| uint32 GRHIThreadTime = 0 |
How many cycles the rhithread used (excluding idle time).
If the rendering thread is in its idle loop (which ticks rendering tickables
| uint32 GSwapBufferTime = 0 |
How many cycles it took to swap buffers to present the frame.
| std::atomic<int> GTimeoutSuspendCount |
| RENDERCORE_API bool GUseThreadedRendering = false |
Whether the rendering thread should be created or not. Currently set by command line parameter and by the ToggleRenderingThread console command.
| FThreadSafeCounter OutstandingHeartbeats |