UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
DynamicResolutionProxy.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "SceneView.h"
8#include "TemporalUpscaler.h"
9
12{
13public:
16
19
21 void CreateNewPreviousFrameTimings_RenderThread(float GameThreadTimeMs, float RenderThreadTimeMs, float TotalFrameGPUBusyTimeMs);
22
25
28 {
30 return QueryCurrentFrameResolutionFractions_Internal();
31 }
32
35 {
37 return QueryCurrentFrameResolutionFractions_Internal();
38 }
39
42
45
48
49private:
50 struct FrameHistoryEntry
51 {
52 float GameThreadTimeMs = -1.0f;
53 float RenderThreadTimeMs = -1.0f;
54
55 // Total GPU busy time for the entire frame in milliseconds.
56 float TotalFrameGPUBusyTimeMs = -1.0f;
57
58 // Time for each individual timings
60
61 // The resolution fraction the frame was rendered with.
62 DynamicRenderScaling::TMap<float> ResolutionFractions;
63
64 FrameHistoryEntry()
65 {
66 ResolutionFractions.SetAll(1.0f);
67 BudgetTimingMs.SetAll(-1.0f);
68 }
69
70 // Returns whether GPU timings have landed.
71 bool HasGPUTimings() const
72 {
73 return TotalFrameGPUBusyTimeMs >= 0.0f;
74 }
75 };
76
77 // Circular buffer of the history.
78 // We don't use TCircularBuffer because it does not support resizes.
80 int32 PreviousFrameIndex;
81 int32 HistorySize;
82
83 // Counts the number of frame since the last screen percentage change.
84 int32 NumberOfFramesSinceScreenPercentageChange;
85
86 // Number of frames remaining to ignore.
87 int32 IgnoreFrameRemainingCount;
88
89 // Current frame's view fraction.
90 DynamicRenderScaling::TMap<float> CurrentFrameResolutionFractions;
91 DynamicRenderScaling::TMap<float> CurrentFrameMaxResolutionFractions;
92 DynamicRenderScaling::TMap<int32> BudgetHistorySizes;
93
94 // Minimum and maximum resolution fractions supported by the main view family's third-party temporal upscaler.
95 float TemporalUpscalerMinResolutionFraction;
96 float TemporalUpscalerMaxResolutionFraction;
97
98 const FrameHistoryEntry& GetPreviousFrameEntry(int32 BrowsingFrameId) const
99 {
101 {
102 static const FrameHistoryEntry InvalidEntry;
103 return InvalidEntry;
104 }
105 return History[(History.Num() + PreviousFrameIndex - BrowsingFrameId) % History.Num()];
106 }
107
108 ENGINE_API DynamicRenderScaling::TMap<float> QueryCurrentFrameResolutionFractions_Internal() const;
109
110 ENGINE_API void RefreshCurrentFrameResolutionFractionUpperBound_RenderThread();
111
112 ENGINE_API void RefreshHeuristicStats_RenderThread();
113
114 ENGINE_API void ResetInternal();
115
116 ENGINE_API void ResizeHistoryIfNeeded();
117};
#define check(expr)
Definition AssertionMacros.h:314
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
CORE_API bool IsInParallelRenderingThread()
Definition ThreadingBase.cpp:301
CORE_API bool IsInGameThread()
Definition ThreadingBase.cpp:185
Definition DynamicRenderScaling.h:172
void SetAll(const Type &Value)
Definition DynamicRenderScaling.h:196
Definition DynamicResolutionProxy.h:12
ENGINE_API ~FDynamicResolutionHeuristicProxy()
Definition DynamicResolution.cpp:147
ENGINE_API void Reset_RenderThread()
Definition DynamicResolution.cpp:152
ENGINE_API FDynamicResolutionHeuristicProxy()
Definition DynamicResolution.cpp:141
ENGINE_API DynamicRenderScaling::TMap< float > GetResolutionFractionUpperBounds() const
Definition DynamicResolution.cpp:500
ENGINE_API void RefreshCurrentFrameResolutionFraction_RenderThread()
Definition DynamicResolution.cpp:215
void CreateNewPreviousFrameTimings_RenderThread(float GameThreadTimeMs, float RenderThreadTimeMs, float TotalFrameGPUBusyTimeMs)
Definition DynamicResolution.cpp:176
ENGINE_API void SetTemporalUpscaler(const UE::Renderer::Private::ITemporalUpscaler *InTemporalUpscaler)
Definition DynamicResolution.cpp:421
DynamicRenderScaling::TMap< float > QueryCurrentFrameResolutionFractions() const
Definition DynamicResolutionProxy.h:27
static ENGINE_API TSharedPtr< class IDynamicResolutionState > CreateDefaultState()
Definition DynamicResolution.cpp:844
DynamicRenderScaling::TMap< float > GetResolutionFractionsApproximation_GameThread() const
Definition DynamicResolutionProxy.h:34
Definition Array.h:670
UE_REWRITE SizeType Num() const
Definition Array.h:1144
Definition SharedPointer.h:692
Definition TemporalUpscaler.h:12