From c55607e409188e934347a13268ebe9ac5454ad34 Mon Sep 17 00:00:00 2001 From: Arttu Peltonen Date: Thu, 14 Oct 2021 12:57:58 +0300 Subject: [PATCH 1/3] Enable runtime profiler tests whenever FTM is enabled. - This allows runtime profiler tests to run in Player builds, now that there's api to query it. --- .../Tests/Runtime/RuntimeProfilerTests.cs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/com.unity.render-pipelines.core/Tests/Runtime/RuntimeProfilerTests.cs b/com.unity.render-pipelines.core/Tests/Runtime/RuntimeProfilerTests.cs index 441d37dc142..e562710058e 100644 --- a/com.unity.render-pipelines.core/Tests/Runtime/RuntimeProfilerTests.cs +++ b/com.unity.render-pipelines.core/Tests/Runtime/RuntimeProfilerTests.cs @@ -21,10 +21,8 @@ class RuntimeProfilerTestBase [SetUp] public void Setup() { -#if UNITY_EDITOR - if (!UnityEditor.PlayerSettings.enableFrameTimingStats) + if (!FrameTimingManager.IsFeatureEnabled()) Assert.Ignore("Frame timing stats are disabled in Player Settings, skipping test."); -#endif // HACK #1 - really shouldn't have to do this here, but previous tests are leaking gameobjects var objects = GameObject.FindObjectsOfType(); @@ -54,9 +52,6 @@ protected IEnumerator Warmup() } } - // FIXME: Tests are disabled in player builds for now, since there's no API that tells whether frame timing is - // enabled or not. Re-enable if that changes. -#if UNITY_EDITOR class RuntimeProfilerTests : RuntimeProfilerTestBase { [UnityTest] @@ -80,5 +75,4 @@ public IEnumerator RuntimeProfilerGivesNonZeroOutput() m_DebugFrameTiming.m_BottleneckHistory.Histogram.PresentLimited > 0); } } -#endif } From a58321b1c18588397445552269b53ae2867b9500 Mon Sep 17 00:00:00 2001 From: Arttu Peltonen Date: Thu, 11 Nov 2021 15:13:17 +0200 Subject: [PATCH 2/3] Disable runtimeprofiler test on Linux due to backend instabilities (case 1370861). --- .../Tests/Runtime/RuntimeProfilerTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.render-pipelines.core/Tests/Runtime/RuntimeProfilerTests.cs b/com.unity.render-pipelines.core/Tests/Runtime/RuntimeProfilerTests.cs index e562710058e..96689606952 100644 --- a/com.unity.render-pipelines.core/Tests/Runtime/RuntimeProfilerTests.cs +++ b/com.unity.render-pipelines.core/Tests/Runtime/RuntimeProfilerTests.cs @@ -52,6 +52,7 @@ protected IEnumerator Warmup() } } + [UnityPlatform(exclude = new RuntimePlatform[] { RuntimePlatform.LinuxPlayer, RuntimePlatform.LinuxEditor })] // Disabled on Linux (case 1370861) class RuntimeProfilerTests : RuntimeProfilerTestBase { [UnityTest] From 27b2a88f729b069ae0294853453123ece512d093 Mon Sep 17 00:00:00 2001 From: Arttu Peltonen Date: Fri, 12 Nov 2021 09:50:35 +0200 Subject: [PATCH 3/3] Use yield return null instead of WaitForEndOfFrame to skip frames. - WaitForEndOfFrame is not supported in batchmode. --- .../Tests/Runtime/RuntimeProfilerTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/com.unity.render-pipelines.core/Tests/Runtime/RuntimeProfilerTests.cs b/com.unity.render-pipelines.core/Tests/Runtime/RuntimeProfilerTests.cs index 96689606952..d62f5779df4 100644 --- a/com.unity.render-pipelines.core/Tests/Runtime/RuntimeProfilerTests.cs +++ b/com.unity.render-pipelines.core/Tests/Runtime/RuntimeProfilerTests.cs @@ -46,7 +46,7 @@ public void TearDown() protected IEnumerator Warmup() { for (int i = 0; i < k_NumWarmupFrames; i++) - yield return new WaitForEndOfFrame(); + yield return null; m_DebugFrameTiming.Reset(); } @@ -66,7 +66,7 @@ public IEnumerator RuntimeProfilerGivesNonZeroOutput() { m_DebugFrameTiming.UpdateFrameTiming(); camera.Render(); - yield return new WaitForEndOfFrame(); + yield return null; } Assert.True(