From 92703af5558258da078d876b1d46e916b1065978 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Wed, 1 Jan 2020 12:39:09 -0300 Subject: Address PR feedback --- Ryujinx.Graphics.Gpu/Engine/MethodReport.cs | 15 ++++++++++----- Ryujinx.Graphics.Gpu/Engine/Methods.cs | 22 +++++++++++----------- 2 files changed, 21 insertions(+), 16 deletions(-) (limited to 'Ryujinx.Graphics.Gpu/Engine') diff --git a/Ryujinx.Graphics.Gpu/Engine/MethodReport.cs b/Ryujinx.Graphics.Gpu/Engine/MethodReport.cs index 8418f0bb..4b6b8fd0 100644 --- a/Ryujinx.Graphics.Gpu/Engine/MethodReport.cs +++ b/Ryujinx.Graphics.Gpu/Engine/MethodReport.cs @@ -8,6 +8,9 @@ namespace Ryujinx.Graphics.Gpu.Engine { partial class Methods { + private const int NsToTicksFractionNumerator = 384; + private const int NsToTicksFractionDenominator = 625; + private ulong _runningCounter; /// @@ -103,8 +106,10 @@ namespace Ryujinx.Graphics.Gpu.Engine /// /// Converts a nanoseconds timestamp value to Maxwell time ticks. - /// The frequency is approximately 1.63Hz. /// + /// + /// The frequency is 614400000 Hz. + /// /// Timestamp in nanoseconds /// Maxwell ticks private static ulong ConvertNanosecondsToTicks(ulong nanoseconds) @@ -112,13 +117,13 @@ namespace Ryujinx.Graphics.Gpu.Engine // We need to divide first to avoid overflows. // We fix up the result later by calculating the difference and adding // that to the result. - ulong divided = nanoseconds / 625; + ulong divided = nanoseconds / NsToTicksFractionDenominator; - ulong rounded = divided * 625; + ulong rounded = divided * NsToTicksFractionDenominator; - ulong errorBias = ((nanoseconds - rounded) * 384) / 625; + ulong errorBias = (nanoseconds - rounded) * NsToTicksFractionNumerator / NsToTicksFractionDenominator; - return divided * 384 + errorBias; + return divided * NsToTicksFractionNumerator + errorBias; } } } \ No newline at end of file diff --git a/Ryujinx.Graphics.Gpu/Engine/Methods.cs b/Ryujinx.Graphics.Gpu/Engine/Methods.cs index 6dce61f2..d832c62e 100644 --- a/Ryujinx.Graphics.Gpu/Engine/Methods.cs +++ b/Ryujinx.Graphics.Gpu/Engine/Methods.cs @@ -48,7 +48,7 @@ namespace Ryujinx.Graphics.Gpu.Engine ShaderCache = new ShaderCache(_context); - _currentProgramInfo = new ShaderProgramInfo[Constants.TotalShaderStages]; + _currentProgramInfo = new ShaderProgramInfo[Constants.ShaderStages]; BufferManager = new BufferManager(context); TextureManager = new TextureManager(context); @@ -201,7 +201,7 @@ namespace Ryujinx.Graphics.Gpu.Engine /// /// Ensures that the bindings are visible to the host GPU. - /// This actually performs the binding using the host graphics API. + /// Note: this actually performs the binding using the host graphics API. /// private void CommitBindings() { @@ -622,7 +622,7 @@ namespace Ryujinx.Graphics.Gpu.Engine /// /// Updates host render target color masks, based on guest GPU state. - /// This defines with color channels are written to each color buffer. + /// This defines which color channels are written to each color buffer. /// /// Current GPU state private void UpdateRtColorMask(GpuState state) @@ -739,7 +739,7 @@ namespace Ryujinx.Graphics.Gpu.Engine _vsUsesInstanceId = gs.Shaders[0].Program.Info.UsesInstanceId; - for (int stage = 0; stage < Constants.TotalShaderStages; stage++) + for (int stage = 0; stage < Constants.ShaderStages; stage++) { ShaderProgramInfo info = gs.Shaders[stage].Program?.Info; @@ -845,7 +845,7 @@ namespace Ryujinx.Graphics.Gpu.Engine return Target.CubemapArray; } - // TODO: Warning. + Logger.PrintWarning(LogClass.Gpu, $"Invalid sampler type \"{type}\"."); return Target.Texture2D; } @@ -855,8 +855,8 @@ namespace Ryujinx.Graphics.Gpu.Engine /// This waits until previous texture writes from the GPU to finish, before /// performing new operations with said textures. /// - /// Current GPU state - /// Method call argument + /// Current GPU state (unused) + /// Method call argument (unused) private void TextureBarrier(GpuState state, int argument) { _context.Renderer.Pipeline.TextureBarrier(); @@ -865,8 +865,8 @@ namespace Ryujinx.Graphics.Gpu.Engine /// /// Invalidates all modified textures on the cache. /// - /// Current GPU state - /// Method call argument + /// Current GPU state (unused) + /// Method call argument (unused) private void InvalidateTextures(GpuState state, int argument) { TextureManager.Flush(); @@ -880,8 +880,8 @@ namespace Ryujinx.Graphics.Gpu.Engine /// and current access has the same access patterns. /// This may be faster than the regular barrier on tile-based rasterizers. /// - /// - /// + /// Current GPU state (unused) + /// Method call argument (unused) private void TextureBarrierTiled(GpuState state, int argument) { _context.Renderer.Pipeline.TextureBarrierTiled(); -- cgit v1.2.3