Skip to content

Commit 21a1411

Browse files
arttu-peltonenEvergreen
authored andcommitted
Enable high-level rendergraph markers for RPCore_PerformanceTests
This PR fixes an issue where RPCore_PerformanceTests test project didn't include the top-level markers after PR https://github.cds.internal.unity3d.com/unity/unity/pull/42503 refactored them.
1 parent fd116bb commit 21a1411

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

Tests/SRPTests/Projects/RPCore_PerformanceTests/Assets/PerformanceTests/Runtime/RenderGraphPerformanceTests.cs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,20 @@ public void RecordAndExecute_MeasureTotal([Values] TestCase testCase, [Values(1,
6666
.Run();
6767
}
6868

69+
IEnumerable<ProfilingSampler> GetAllMarkers()
70+
{
71+
// High level profiling markers for Render Graph
72+
foreach (var val in Enum.GetValues(typeof(RenderGraphProfileId)))
73+
yield return ProfilingSampler.Get((RenderGraphProfileId)val);
74+
75+
if (m_Compiler == Compiler.NativeRenderGraph)
76+
{
77+
// Low level profiling markers for Native Render Pass Compiler
78+
foreach (var val in Enum.GetValues(typeof(NativePassCompiler.NativeCompilerProfileId)))
79+
yield return ProfilingSampler.Get((NativePassCompiler.NativeCompilerProfileId)val);
80+
}
81+
}
82+
6983
// This is a [UnityTest] because Profiling.Recorder requires frame tick to happen.
7084
[UnityTest, Performance]
7185
public IEnumerator RecordAndExecute_MeasureProfileIds([Values] TestCase testCase, [Values(1, 5, 15)] int numPasses)
@@ -80,20 +94,8 @@ public IEnumerator RecordAndExecute_MeasureProfileIds([Values] TestCase testCase
8094

8195
List<(SampleGroup, ProfilingSampler)> samplers = new();
8296

83-
ProfilingSampler GetSampler(object profilerId) => m_Compiler switch
84-
{
85-
Compiler.NativeRenderGraph => ProfilingSampler.Get((NativePassCompiler.NativeCompilerProfileId) profilerId),
86-
Compiler.RenderGraph => ProfilingSampler.Get((RenderGraphProfileId) profilerId),
87-
_ => throw new NotImplementedException()
88-
};
89-
90-
Type profileIdEnumType = m_Compiler == Compiler.NativeRenderGraph
91-
? typeof(NativePassCompiler.NativeCompilerProfileId)
92-
: typeof(RenderGraphProfileId);
93-
94-
foreach (var profilerId in Enum.GetValues(profileIdEnumType))
97+
foreach (var sampler in GetAllMarkers())
9598
{
96-
var sampler = GetSampler(profilerId);
9799
samplers.Add((new SampleGroup(sampler.name), sampler));
98100
sampler.enableRecording = true;
99101
}

0 commit comments

Comments
 (0)