Beispiel #1
0
        // Returns the time of the most recent number of dropped frames, null on failure.
        public int?GetDroppedFrames()
        {
            if (App.Config.m_SdkMode == SdkMode.SteamVR)
            {
                SteamVR vr = SteamVR.instance;
                if (vr != null)
                {
                    if (vr.compositor.GetFrameTiming(ref m_FrameTiming, 0 /* most recent frame */))
                    {
                        return((int)m_FrameTiming.m_nNumDroppedFrames);
                    }
                }
            }
            else if (App.Config.m_SdkMode == SdkMode.Oculus)
            {
#if OCULUS_SUPPORTED
                OVRPlugin.AppPerfStats perfStats = OVRPlugin.GetAppPerfStats();
                if (perfStats.FrameStatsCount > 0)
                {
                    return(perfStats.FrameStats[0].AppDroppedFrameCount);
                }
                return(0);
#endif // OCULUS_SUPPORTED
            }

            return(null);
        }
Beispiel #2
0
    float GetPerformanceScaleFactor()
    {
#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
        OVRPlugin.AppPerfStats stats = OVRPlugin.GetAppPerfStats();
        float scale = Mathf.Sqrt(stats.AdaptiveGpuPerformanceScale);
#else
        float scale = 1.0f;
#endif
        _gpuScale = Mathf.Clamp(_gpuScale * scale, 0.5f, 2.0f);
        return(_gpuScale);
    }