Skip to content

Commit 960e78e

Browse files
amaestas13GitHub Enterprise
authored andcommitted
Merge pull request #6 from unity/JsonParserUpdate
Additional Fixes
2 parents e0e2508 + 0078d23 commit 960e78e

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

UnityPerformanceBenchmarkReporter/Entities/SampleGroup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class SampleGroupDefinition
2424
{
2525
public string Name;
2626
public SampleUnit SampleUnit;
27-
public AggregationType AggregationType;
27+
public AggregationType AggregationType = AggregationType.Median;
2828
public double Threshold;
2929
public bool IncreaseIsBetter;
3030
public double Percentile;

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)