Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
JoeriCG's avatar
JoeriCG
Explorer
4 years ago

Get GPU frametime on Quest

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

Replies have been turned off for this discussion
  • 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.

  • 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!