diff options
author | OpaqueReptile <1337paf92@gmail.com> | 2023-05-17 13:38:59 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-17 15:38:59 -0300 |
commit | cb4b58052f325864ece956898cdd64373edf896a (patch) | |
tree | 80b28738794e3defcd99ad9a32d541af1b9b2f65 /src | |
parent | f8cdd5f484f1b1d0c633f6da2016713e14e4c6e7 (diff) |
Start GPU performance counter at 0 instead of host GPU value (#4992)1.1.802
* Start performance counter at 0 instead of host perf counter value
* whitespace
* init _firstTimestamp in constructer per feedback
* change comment
* punctuation
* address feedback
* revise comment
Diffstat (limited to 'src')
-rw-r--r-- | src/Ryujinx.Graphics.Gpu/GpuContext.cs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Ryujinx.Graphics.Gpu/GpuContext.cs b/src/Ryujinx.Graphics.Gpu/GpuContext.cs index ccaabf70..0fe6a28f 100644 --- a/src/Ryujinx.Graphics.Gpu/GpuContext.cs +++ b/src/Ryujinx.Graphics.Gpu/GpuContext.cs @@ -99,6 +99,7 @@ namespace Ryujinx.Graphics.Gpu private bool _pendingSync; private long _modifiedSequence; + private ulong _firstTimestamp; /// <summary> /// Creates a new instance of the GPU emulation context. @@ -123,6 +124,8 @@ namespace Ryujinx.Graphics.Gpu DeferredActions = new Queue<Action>(); PhysicalMemoryRegistry = new ConcurrentDictionary<ulong, PhysicalMemory>(); + + _firstTimestamp = ConvertNanosecondsToTicks((ulong)PerformanceCounter.ElapsedNanoseconds); } /// <summary> @@ -217,7 +220,8 @@ namespace Ryujinx.Graphics.Gpu /// <returns>The current GPU timestamp</returns> public ulong GetTimestamp() { - ulong ticks = ConvertNanosecondsToTicks((ulong)PerformanceCounter.ElapsedNanoseconds); + // Guest timestamp will start at 0, instead of host value. + ulong ticks = ConvertNanosecondsToTicks((ulong)PerformanceCounter.ElapsedNanoseconds) - _firstTimestamp; if (GraphicsConfig.FastGpuTime) { |