Skip to content

Commit

Permalink
[VFX/Test] Add prefix in performance test (Unity-Technologies#5905)
Browse files Browse the repository at this point in the history
* Add SRP prefix in performance test

The recently configured stonk bot mixes up between URP & HDRP test with same name.
Add a filer in runtime & editor performance test with SRP name to avoid avalanche of wrong analysis.

* *Rename HDRenderpipeline in HDRP
  • Loading branch information
PaulDemeulenaere committed Oct 11, 2021
1 parent 4523bd2 commit 2df7f93
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"Unity.RenderPipelines.Core.Runtime",
"Unity.GraphicTests.Performance.Editor",
"Unity.GraphicTests.Performance.Runtime",
"Unity.Testing.VisualEffectGraph.PerformanceRuntimeTests",
"Unity.VisualEffectGraph.Editor"
],
"includePlatforms": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ static IEnumerable<string> allVisualEffectAsset
}
}

//Expecting only one value in this field in editor mode, it's actually a dummy variadic parameter to help filter in observer database
static IEnumerable<string> allActiveSRP
{
get
{
yield return UnityEngine.VFX.PerformanceTest.VFXPerformanceUseGraphicsTestCasesAttribute.GetPrefix();
}
}

static IEnumerable<string> allCompilationMode
{
get
Expand Down Expand Up @@ -100,7 +109,7 @@ private static void LoadVFXGraph(string vfxAssetName, out string fullPath, out V
}

[Timeout(k_BuildTimeout), Version("1"), Test, Performance]
public void Load_VFXLibrary()
public void Load_VFXLibrary([ValueSource(nameof(allActiveSRP))] string srp)
{
for (int i = 0; i < 16; i++) //Doing this multiple time to have an average result
{
Expand All @@ -113,7 +122,7 @@ public void Load_VFXLibrary()
}

[Timeout(k_BuildTimeout), Version("1"), UnityTest, Performance]
public IEnumerator VFXViewWindow_Open_And_Render([ValueSource("allVisualEffectAsset")] string vfxAssetPath)
public IEnumerator VFXViewWindow_Open_And_Render([ValueSource(nameof(allActiveSRP))] string srp, [ValueSource(nameof(allVisualEffectAsset))] string vfxAssetPath)
{
VFXGraph graph;
string fullPath;
Expand Down Expand Up @@ -155,7 +164,7 @@ public IEnumerator VFXViewWindow_Open_And_Render([ValueSource("allVisualEffectAs

//Measure backup (for undo/redo & Duplicate) time for every existing asset
[Timeout(k_BuildTimeout), Version("1"), Test, Performance]
public void Backup_And_Restore([ValueSource("allVisualEffectAsset")] string vfxAssetPath)
public void Backup_And_Restore([ValueSource(nameof(allActiveSRP))] string srp, [ValueSource(nameof(allVisualEffectAsset))] string vfxAssetPath)
{
VFXGraph graph;
string fullPath;
Expand Down Expand Up @@ -184,7 +193,7 @@ public void Backup_And_Restore([ValueSource("allVisualEffectAsset")] string vfxA

static readonly string[] allForceShaderValidation = { "ShaderValidation_On", "ShaderValidation_Off" };
[Timeout(k_BuildTimeout), Version("1"), Test, Performance]
public void Compilation(/*[ValueSource("allForceShaderValidation")] string forceShaderValidationModeName,*/ [ValueSource("allCompilationMode")] string compilationModeName, [ValueSource("allVisualEffectAsset")] string vfxAssetPath)
public void Compilation([ValueSource(nameof(allActiveSRP))] string srp, /*[ValueSource("allForceShaderValidation")] string forceShaderValidationModeName,*/ [ValueSource("allCompilationMode")] string compilationModeName, [ValueSource("allVisualEffectAsset")] string vfxAssetPath)
{
VFXCompilationMode compilationMode;
Enum.TryParse<VFXCompilationMode>(compilationModeName, out compilationMode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using NUnit.Framework;
using UnityEngine.TestTools.Graphics;
using UnityEngine.Scripting;
using UnityEngine.Rendering;
#if UNITY_EDITOR
using UnityEditor;
using System.Linq;
Expand All @@ -20,6 +21,17 @@ public class VFXPerformanceUseGraphicsTestCasesAttribute : UnityTestAttribute, I
{
NUnitTestCaseBuilder m_Builder = new NUnitTestCaseBuilder();

public static string GetPrefix()
{
//Can't use SRPBinder here, this code is also runtime
var currentSRP = QualitySettings.renderPipeline ?? GraphicsSettings.currentRenderPipeline;
if (currentSRP == null)
return "BRP";
if (currentSRP.name.Contains("HDRenderPipeline"))
return "HDRP";
return currentSRP.name;
}

IEnumerable<TestMethod> ITestBuilder.BuildFrom(IMethodInfo method, Test suite)
{
var results = new List<TestMethod>();
Expand Down Expand Up @@ -49,7 +61,7 @@ IEnumerable<TestMethod> ITestBuilder.BuildFrom(IMethodInfo method, Test suite)
if (test.parms != null)
test.parms.HasExpectedResult = false;

test.Name = Path.GetFileNameWithoutExtension(scenePath);
test.Name = string.Format("{0}.{1}", GetPrefix(), Path.GetFileNameWithoutExtension(scenePath));
results.Add(test);
}
return results;
Expand Down

0 comments on commit 2df7f93

Please sign in to comment.