Hello Epic Developers,
Our team is trying to enable “dynamic resolution” on Windows, although this feature is not recommended for a Windows D3D12 game.
When we enable the Frame Rate Limiter(t.MaxFPS) or VSync, such as 60 FPS, the GPU time returned by the following code also includes idle or stall time(Frame Cycles Bubbles).
“RHIGetGPUFrameCycles” returns “GGPUFrameTime”, which is the variable referenced by “Stat Unit” as well.
float PrevFrameGPUTimeMs = FPlatformTime::ToMilliseconds(RHIGetGPUFrameCycles());
We tried using time queries by enabling CVarTimingMeasureModel(r.DynamicRes.GPUTimingMeasureMethod).
And it does return the actual GPU busy time when we set the max FPS by the Frame Rate Limiter.
But it still doesn’t work when VSync is on.
So we’d like to know:
Is there any possibility to get GPU time without bubble time in UE4.27?
Hello,
Thank you for reaching out.
I’ve been assigned this issue, and we will be looking this performance metric collection for you.
Hello,
With VSync enabled, you cannot get the GPU time without bubbles. In general on D3D12, the GPU time is assumed to have bubbles - see the usage of “GRHISupportsFrameCyclesBubblesRemoval” in DynamicResolution.cpp.
“r.Vsync” will enable “IDXGISwapChain::Present(…)” synchronization to vertical blanks (as controlled by “rhi.SyncInterval”). This can cause the “Present(…)” to block execution until a synchronization point.
Dynamic Resolution’s GPU end frame event is enqueued after Slate’s draw window event, meaning that the timing query for begin/end frames will contain the time used by “Present(…)”.
To work around the bubbles, you can try tuning the CVar “r.DynamicRes.CPUTimeHeadRoom” to represent the average amount of time your GPU bubbles take. This value will be added to the measured GPU frame time.
Please let us know if this helps.