From 91fa1debd4c5791a12733d75d7ce06a23a1547ff Mon Sep 17 00:00:00 2001 From: gdkchan Date: Mon, 20 Apr 2020 09:41:07 -0300 Subject: [PATCH] Report more realistic GPU timestamps when FastGpuTime is enabled (#1139) --- Ryujinx.Graphics.Gpu/Engine/MethodReport.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Ryujinx.Graphics.Gpu/Engine/MethodReport.cs b/Ryujinx.Graphics.Gpu/Engine/MethodReport.cs index 0565acdc7..15151c62a 100644 --- a/Ryujinx.Graphics.Gpu/Engine/MethodReport.cs +++ b/Ryujinx.Graphics.Gpu/Engine/MethodReport.cs @@ -11,8 +11,6 @@ namespace Ryujinx.Graphics.Gpu.Engine private const int NsToTicksFractionNumerator = 384; private const int NsToTicksFractionDenominator = 625; - private ulong _runningCounter; - /// /// Writes a GPU counter to guest memory. /// @@ -81,15 +79,13 @@ namespace Ryujinx.Graphics.Gpu.Engine break; } - ulong ticks; + ulong ticks = ConvertNanosecondsToTicks((ulong)PerformanceCounter.ElapsedNanoseconds); if (GraphicsConfig.FastGpuTime) { - ticks = _runningCounter++; - } - else - { - ticks = ConvertNanosecondsToTicks((ulong)PerformanceCounter.ElapsedNanoseconds); + // Divide by some amount to report time as if operations were performed faster than they really are. + // This can prevent some games from switching to a lower resolution because rendering is too slow. + ticks /= 256; } counterData.Counter = counter;