Example #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);
        }
Example #2
0
        private int GetDroppedFramesOculus()
        {
            var stats = OVRPlugin.GetAppPerfStats();

            if (stats.FrameStatsCount > 0)
            {
                return(stats.FrameStats[stats.FrameStatsCount - 1].AppDroppedFrameCount);
            }

            return(0);
        }
Example #3
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);
    }
Example #4
0
        private int GetGPUMsOculus()
        {
            var stats = OVRPlugin.GetAppPerfStats();

            if (stats.FrameStatsCount > 0)
            {
                // To get Total GPU, maybe we have to sum AppGpuElapsedTime with CompositorGpuElapsedTime.
                return(Mathf.RoundToInt(stats.FrameStats[stats.FrameStatsCount - 1].AppGpuElapsedTime));
            }

            return(0);
        }