diff --git a/Ryujinx.Graphics/Gal/Shader/GlslDecompiler.cs b/Ryujinx.Graphics/Gal/Shader/GlslDecompiler.cs index e6fb7ea147..b74ecabfab 100644 --- a/Ryujinx.Graphics/Gal/Shader/GlslDecompiler.cs +++ b/Ryujinx.Graphics/Gal/Shader/GlslDecompiler.cs @@ -1,3 +1,4 @@ +using Ryujinx.Profiler; using System; using System.Collections.Generic; using System.Globalization; @@ -118,6 +119,8 @@ namespace Ryujinx.Graphics.Gal.Shader long VpBPosition, GalShaderType ShaderType) { + Profile.Begin(Profiles.GPU.Shader.Decompile); + Header = new ShaderHeader(Memory, VpAPosition); HeaderB = new ShaderHeader(Memory, VpBPosition); @@ -129,11 +132,17 @@ namespace Ryujinx.Graphics.Gal.Shader Decl = GlslDecl.Merge(DeclVpA, DeclVpB); - return Decompile(); + GlslProgram result = Decompile(); + + Profile.End(Profiles.GPU.Shader.Decompile); + + return result; } public GlslProgram Decompile(IGalMemory Memory, long Position, GalShaderType ShaderType) { + Profile.Begin(Profiles.GPU.Shader.Decompile); + Header = new ShaderHeader(Memory, Position); HeaderB = null; @@ -142,7 +151,11 @@ namespace Ryujinx.Graphics.Gal.Shader Decl = new GlslDecl(Blocks, ShaderType, Header); - return Decompile(); + GlslProgram result = Decompile(); + + Profile.End(Profiles.GPU.Shader.Decompile); + + return result; } private GlslProgram Decompile() diff --git a/Ryujinx.Graphics/Graphics3d/NvGpuEngineM2mf.cs b/Ryujinx.Graphics/Graphics3d/NvGpuEngineM2mf.cs index d89059c0c5..e7198bc62f 100644 --- a/Ryujinx.Graphics/Graphics3d/NvGpuEngineM2mf.cs +++ b/Ryujinx.Graphics/Graphics3d/NvGpuEngineM2mf.cs @@ -1,6 +1,7 @@ using Ryujinx.Graphics.Memory; using Ryujinx.Graphics.Texture; using System.Collections.Generic; +using Ryujinx.Profiler; namespace Ryujinx.Graphics.Graphics3d { @@ -37,7 +38,12 @@ namespace Ryujinx.Graphics.Graphics3d { if (Methods.TryGetValue(MethCall.Method, out NvGpuMethod Method)) { + ProfileConfig profile = Profiles.GPU.EngineM2mf.CallMethod; + profile.SessionItem = Method.Method.Name; + + Profile.Begin(profile); Method(Vmm, MethCall); + Profile.End(profile); } else { @@ -47,6 +53,8 @@ namespace Ryujinx.Graphics.Graphics3d private void Execute(NvGpuVmm Vmm, GpuMethodCall MethCall) { + Profile.Begin(Profiles.GPU.EngineM2mf.Execute); + //TODO: Some registers and copy modes are still not implemented. int Control = MethCall.Argument; @@ -160,6 +168,8 @@ namespace Ryujinx.Graphics.Graphics3d { Vmm.Memory.CopyBytes(SrcPA, DstPA, XCount); } + + Profile.End(Profiles.GPU.EngineM2mf.Execute); } private long MakeInt64From2xInt32(NvGpuEngineM2mfReg Reg) diff --git a/Ryujinx.Graphics/Graphics3d/NvGpuEngineP2mf.cs b/Ryujinx.Graphics/Graphics3d/NvGpuEngineP2mf.cs index 681552556c..a5e668e9d9 100644 --- a/Ryujinx.Graphics/Graphics3d/NvGpuEngineP2mf.cs +++ b/Ryujinx.Graphics/Graphics3d/NvGpuEngineP2mf.cs @@ -1,6 +1,7 @@ using Ryujinx.Graphics.Memory; using Ryujinx.Graphics.Texture; using System.Collections.Generic; +using Ryujinx.Profiler; namespace Ryujinx.Graphics.Graphics3d { @@ -54,7 +55,12 @@ namespace Ryujinx.Graphics.Graphics3d { if (Methods.TryGetValue(MethCall.Method, out NvGpuMethod Method)) { + ProfileConfig profile = Profiles.GPU.EngineP2mf.PushData; + profile.SessionItem = Method.Method.Name; + + Profile.Begin(profile); Method(Vmm, MethCall); + Profile.End(profile); } else { @@ -64,6 +70,8 @@ namespace Ryujinx.Graphics.Graphics3d private void Execute(NvGpuVmm Vmm, GpuMethodCall MethCall) { + Profile.Begin(Profiles.GPU.EngineP2mf.Execute); + //TODO: Some registers and copy modes are still not implemented. int Control = MethCall.Argument; @@ -97,6 +105,8 @@ namespace Ryujinx.Graphics.Graphics3d CopySize = LineLengthIn * LineCount; Buffer = new byte[CopySize]; + + Profile.End(Profiles.GPU.EngineP2mf.Execute); } private void PushData(NvGpuVmm Vmm, GpuMethodCall MethCall) @@ -106,6 +116,8 @@ namespace Ryujinx.Graphics.Graphics3d return; } + Profile.Begin(Profiles.GPU.EngineP2mf.PushData); + for (int Shift = 0; Shift < 32 && CopyOffset < CopySize; Shift += 8, CopyOffset++) { Buffer[CopyOffset] = (byte)(MethCall.Argument >> Shift); @@ -134,6 +146,8 @@ namespace Ryujinx.Graphics.Graphics3d Buffer = null; } + + Profile.End(Profiles.GPU.EngineP2mf.PushData); } private long MakeInt64From2xInt32(NvGpuEngineP2mfReg Reg) diff --git a/Ryujinx.Profiler/ProfileConfig.cs b/Ryujinx.Profiler/ProfileConfig.cs index b2645b05c6..afad84bd8d 100644 --- a/Ryujinx.Profiler/ProfileConfig.cs +++ b/Ryujinx.Profiler/ProfileConfig.cs @@ -192,6 +192,51 @@ namespace Ryujinx.Profiler SessionGroup = "ConfigureState" }; } + + public static class EngineM2mf + { + public static ProfileConfig CallMethod = new ProfileConfig() + { + Category = "GPU.EngineM2mf", + SessionGroup = "CallMethod", + }; + + public static ProfileConfig Execute = new ProfileConfig() + { + Category = "GPU.EngineM2mf", + SessionGroup = "Execute", + }; + } + + public static class EngineP2mf + { + public static ProfileConfig CallMethod = new ProfileConfig() + { + Category = "GPU.EngineP2mf", + SessionGroup = "CallMethod", + }; + + public static ProfileConfig Execute = new ProfileConfig() + { + Category = "GPU.EngineP2mf", + SessionGroup = "Execute", + }; + + public static ProfileConfig PushData = new ProfileConfig() + { + Category = "GPU.EngineP2mf", + SessionGroup = "PushData", + }; + } + + public static class Shader + { + public static ProfileConfig Decompile = new ProfileConfig() + { + Category = "GPU.Shader", + SessionGroup = "Decompile", + }; + } } public static ProfileConfig ServiceCall = new ProfileConfig()