Skip to content

Commit

Permalink
Merge pull request #6040 from Susko3/fix-touch-framestatistics
Browse files Browse the repository at this point in the history
Fix `FrameStatisticsViaTouch` to work as described in the wiki
  • Loading branch information
peppy authored Nov 10, 2023
2 parents d670ab5 + 79bcefa commit 5c5c6c5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
23 changes: 19 additions & 4 deletions osu.Framework/FrameworkEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public static class FrameworkEnvironment
static FrameworkEnvironment()
{
StartupExecutionMode = Enum.TryParse<ExecutionMode>(Environment.GetEnvironmentVariable("OSU_EXECUTION_MODE"), true, out var mode) ? mode : null;
NoTestTimeout = Environment.GetEnvironmentVariable("OSU_TESTS_NO_TIMEOUT") == "1";
ForceTestGC = Environment.GetEnvironmentVariable("OSU_TESTS_FORCED_GC") == "1";
FrameStatisticsViaTouch = Environment.GetEnvironmentVariable("OSU_FRAME_STATISTICS_VIA_TOUCH") == "1";
NoTestTimeout = parseBool(Environment.GetEnvironmentVariable("OSU_TESTS_NO_TIMEOUT")) ?? false;
ForceTestGC = parseBool(Environment.GetEnvironmentVariable("OSU_TESTS_FORCED_GC")) ?? false;
FrameStatisticsViaTouch = parseBool(Environment.GetEnvironmentVariable("OSU_FRAME_STATISTICS_VIA_TOUCH")) ?? true;
PreferredGraphicsSurface = Enum.TryParse<GraphicsSurfaceType>(Environment.GetEnvironmentVariable("OSU_GRAPHICS_SURFACE"), true, out var surface) ? surface : null;
PreferredGraphicsRenderer = Environment.GetEnvironmentVariable("OSU_GRAPHICS_RENDERER")?.ToLowerInvariant();

Expand All @@ -33,7 +33,22 @@ static FrameworkEnvironment()
if (int.TryParse(Environment.GetEnvironmentVariable("OSU_GRAPHICS_STAGING_BUFFER_TYPE"), out int stagingBufferImplementation))
StagingBufferType = stagingBufferImplementation;

NoStructuredBuffers = Environment.GetEnvironmentVariable("OSU_GRAPHICS_NO_SSBO") == "1";
NoStructuredBuffers = parseBool(Environment.GetEnvironmentVariable("OSU_GRAPHICS_NO_SSBO")) ?? false;
}

private static bool? parseBool(string? value)
{
switch (value)
{
case "0":
return false;

case "1":
return true;

default:
return bool.TryParse(value, out bool b) ? b : null;
}
}
}
}
2 changes: 1 addition & 1 deletion osu.Framework/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ protected override void LoadComplete()

FrameStatistics.BindValueChanged(e => performanceOverlay.State = e.NewValue, true);

if (FrameworkEnvironment.FrameStatisticsViaTouch || DebugUtils.IsDebugBuild)
if (FrameworkEnvironment.FrameStatisticsViaTouch && DebugUtils.IsDebugBuild)
{
base.AddInternal(new FrameStatisticsTouchReceptor(this)
{
Expand Down

0 comments on commit 5c5c6c5

Please sign in to comment.