From 0078d23b90f8c6e6e3d577e5c6e585c6956d047d Mon Sep 17 00:00:00 2001 From: "andre.maestas" Date: Tue, 14 Jun 2022 17:18:33 -0700 Subject: [PATCH] Added ability to get stereo mode from custom sstring field workaround for perf framework always reporting multipass --- .../TestResultJsonParser.cs | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/UnityPerformanceBenchmarkReporter/TestResultJsonParser.cs b/UnityPerformanceBenchmarkReporter/TestResultJsonParser.cs index bcb514f..8c828c4 100644 --- a/UnityPerformanceBenchmarkReporter/TestResultJsonParser.cs +++ b/UnityPerformanceBenchmarkReporter/TestResultJsonParser.cs @@ -53,6 +53,8 @@ namespace UnityPerformanceBenchmarkReporter try { result = JsonConvert.DeserializeObject(json); + var path = result.PlayerSettings.StereoRenderingPath; + result.PlayerSettings.StereoRenderingPath = GetStereoPath(path,result.PlayerSettings.AndroidTargetSdkVersion); } catch (System.Exception) { @@ -104,7 +106,7 @@ namespace UnityPerformanceBenchmarkReporter AndroidTargetSdkVersion = run.Player.AndroidTargetSdkVersion, EnabledXrTargets = new List(), ScriptingRuntimeVersion = "", - StereoRenderingPath = run.Player.StereoRenderingPath + StereoRenderingPath = GetStereoPath(run.Player.StereoRenderingPath, run.Player.AndroidTargetSdkVersion) }, QualitySettings = new QualitySettings() { @@ -177,5 +179,40 @@ namespace UnityPerformanceBenchmarkReporter return null; } + /// This allows us to get the stereo mode from a custom data string as well as the normal stereo mode setting + /// This is due to a bug in the perf framework where the stereo mode always displays multipass + /// We pass this custom string in as AndroidTargetSDKVersion + /// The second parameter takes in this string compares the values and overwrites the stereo mode if the mode in the custom string eists and is different + private static string GetStereoPath(string stereoModeString, string miscDataString) + { + + if(string.IsNullOrWhiteSpace(stereoModeString)) + { + Console.WriteLine("Stereo Mode String Is Null"); + return ""; + } + + + Regex stereoModeRegex = new Regex(@"stereorenderingmode=([^|]*)"); + var match = stereoModeRegex.Match(miscDataString); + if(match.Success) + { + if(stereoModeString.ToLower() == match.Value.ToLower()) + { + return stereoModeString; + } + else + { + return match.Value; + } + } + else + { + Console.WriteLine("Failed To Parse Custom Data String for StereoMode"); + return stereoModeString; + } + + + } } }