cancel
Showing results for 
Search instead for 
Did you mean: 

Get GPU frametime on Quest

JoeriCG
Explorer

I'm trying to implement Unity's Dynamic Resolution as a quick fix for the remaining GPU-bound scenarios in our game, but I'm running into the issue that I can't seem to get the last GPU frametime no matter what API I use. Neither FrameTimingManager.GetLatestTimings, XRStats.TryGetGPUTimeLastFrame, nor XRDisplaySubsystem.TryGetAppGPUTimeLastFrame seem to work on my Quest 2 (but do in-editor via Link). What is the preferred method to get the GPU frametime on Quest?

 

To clarify, the game is using Vulkan and the VRAPI (not OpenXR).

2 REPLIES 2

lordzargon
Honored Guest

I'm having this exact issue. Did you ever find a solution? I've tried no less than 6 different API calls to try and get this information, yet they all fail or return 0.

lordzargon
Honored Guest

I got it. 

You need this in your Start/Awake function (or whenever you want to start tracking the GPU App time)

 

void OnEnable()
{
    Unity.XR.Oculus.Stats.PerfMetrics.EnablePerfMetrics(true);
}

void OnDisable()
{
    Unity.XR.Oculus.Stats.PerfMetrics.EnablePerfMetrics(false);
}

 

 

Then, in your Update...

 

float appGPUTime = Unity.XR.Oculus.Stats.PerfMetrics.AppGPUTime;

 

 

That got it for me.

Hope that helps!