Skip to content

Commit 0078d23

Browse files
committed
Added ability to get stereo mode from custom sstring field
workaround for perf framework always reporting multipass
1 parent 052c11d commit 0078d23

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

UnityPerformanceBenchmarkReporter/TestResultJsonParser.cs

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ private static PerformanceTestRun ParseJsonV1(string json)
5353
try
5454
{
5555
result = JsonConvert.DeserializeObject<PerformanceTestRun>(json);
56+
var path = result.PlayerSettings.StereoRenderingPath;
57+
result.PlayerSettings.StereoRenderingPath = GetStereoPath(path,result.PlayerSettings.AndroidTargetSdkVersion);
5658
}
5759
catch (System.Exception)
5860
{
@@ -104,7 +106,7 @@ private static PerformanceTestRun ParseJsonV2(string json)
104106
AndroidTargetSdkVersion = run.Player.AndroidTargetSdkVersion,
105107
EnabledXrTargets = new List<string>(),
106108
ScriptingRuntimeVersion = "",
107-
StereoRenderingPath = run.Player.StereoRenderingPath
109+
StereoRenderingPath = GetStereoPath(run.Player.StereoRenderingPath, run.Player.AndroidTargetSdkVersion)
108110
},
109111
QualitySettings = new QualitySettings()
110112
{
@@ -177,5 +179,40 @@ private static PerformanceTestRun ParseJsonV2(string json)
177179
return null;
178180
}
179181

182+
/// This allows us to get the stereo mode from a custom data string as well as the normal stereo mode setting
183+
/// This is due to a bug in the perf framework where the stereo mode always displays multipass
184+
/// We pass this custom string in as AndroidTargetSDKVersion
185+
/// 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
186+
private static string GetStereoPath(string stereoModeString, string miscDataString)
187+
{
188+
189+
if(string.IsNullOrWhiteSpace(stereoModeString))
190+
{
191+
Console.WriteLine("Stereo Mode String Is Null");
192+
return "";
193+
}
194+
195+
196+
Regex stereoModeRegex = new Regex(@"stereorenderingmode=([^|]*)");
197+
var match = stereoModeRegex.Match(miscDataString);
198+
if(match.Success)
199+
{
200+
if(stereoModeString.ToLower() == match.Value.ToLower())
201+
{
202+
return stereoModeString;
203+
}
204+
else
205+
{
206+
return match.Value;
207+
}
208+
}
209+
else
210+
{
211+
Console.WriteLine("Failed To Parse Custom Data String for StereoMode");
212+
return stereoModeString;
213+
}
214+
215+
216+
}
180217
}
181218
}

0 commit comments

Comments
 (0)