Profiled M2mf, P2mf and shader compilation

This commit is contained in:
Andy Adshead 2019-02-02 13:00:57 +00:00
commit c1dc2ce458
4 changed files with 84 additions and 2 deletions

View file

@ -1,3 +1,4 @@
using Ryujinx.Profiler;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
@ -118,6 +119,8 @@ namespace Ryujinx.Graphics.Gal.Shader
long VpBPosition, long VpBPosition,
GalShaderType ShaderType) GalShaderType ShaderType)
{ {
Profile.Begin(Profiles.GPU.Shader.Decompile);
Header = new ShaderHeader(Memory, VpAPosition); Header = new ShaderHeader(Memory, VpAPosition);
HeaderB = new ShaderHeader(Memory, VpBPosition); HeaderB = new ShaderHeader(Memory, VpBPosition);
@ -129,11 +132,17 @@ namespace Ryujinx.Graphics.Gal.Shader
Decl = GlslDecl.Merge(DeclVpA, DeclVpB); 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) public GlslProgram Decompile(IGalMemory Memory, long Position, GalShaderType ShaderType)
{ {
Profile.Begin(Profiles.GPU.Shader.Decompile);
Header = new ShaderHeader(Memory, Position); Header = new ShaderHeader(Memory, Position);
HeaderB = null; HeaderB = null;
@ -142,7 +151,11 @@ namespace Ryujinx.Graphics.Gal.Shader
Decl = new GlslDecl(Blocks, ShaderType, Header); Decl = new GlslDecl(Blocks, ShaderType, Header);
return Decompile(); GlslProgram result = Decompile();
Profile.End(Profiles.GPU.Shader.Decompile);
return result;
} }
private GlslProgram Decompile() private GlslProgram Decompile()

View file

@ -1,6 +1,7 @@
using Ryujinx.Graphics.Memory; using Ryujinx.Graphics.Memory;
using Ryujinx.Graphics.Texture; using Ryujinx.Graphics.Texture;
using System.Collections.Generic; using System.Collections.Generic;
using Ryujinx.Profiler;
namespace Ryujinx.Graphics.Graphics3d namespace Ryujinx.Graphics.Graphics3d
{ {
@ -37,7 +38,12 @@ namespace Ryujinx.Graphics.Graphics3d
{ {
if (Methods.TryGetValue(MethCall.Method, out NvGpuMethod Method)) 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); Method(Vmm, MethCall);
Profile.End(profile);
} }
else else
{ {
@ -47,6 +53,8 @@ namespace Ryujinx.Graphics.Graphics3d
private void Execute(NvGpuVmm Vmm, GpuMethodCall MethCall) private void Execute(NvGpuVmm Vmm, GpuMethodCall MethCall)
{ {
Profile.Begin(Profiles.GPU.EngineM2mf.Execute);
//TODO: Some registers and copy modes are still not implemented. //TODO: Some registers and copy modes are still not implemented.
int Control = MethCall.Argument; int Control = MethCall.Argument;
@ -160,6 +168,8 @@ namespace Ryujinx.Graphics.Graphics3d
{ {
Vmm.Memory.CopyBytes(SrcPA, DstPA, XCount); Vmm.Memory.CopyBytes(SrcPA, DstPA, XCount);
} }
Profile.End(Profiles.GPU.EngineM2mf.Execute);
} }
private long MakeInt64From2xInt32(NvGpuEngineM2mfReg Reg) private long MakeInt64From2xInt32(NvGpuEngineM2mfReg Reg)

View file

@ -1,6 +1,7 @@
using Ryujinx.Graphics.Memory; using Ryujinx.Graphics.Memory;
using Ryujinx.Graphics.Texture; using Ryujinx.Graphics.Texture;
using System.Collections.Generic; using System.Collections.Generic;
using Ryujinx.Profiler;
namespace Ryujinx.Graphics.Graphics3d namespace Ryujinx.Graphics.Graphics3d
{ {
@ -54,7 +55,12 @@ namespace Ryujinx.Graphics.Graphics3d
{ {
if (Methods.TryGetValue(MethCall.Method, out NvGpuMethod Method)) 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); Method(Vmm, MethCall);
Profile.End(profile);
} }
else else
{ {
@ -64,6 +70,8 @@ namespace Ryujinx.Graphics.Graphics3d
private void Execute(NvGpuVmm Vmm, GpuMethodCall MethCall) private void Execute(NvGpuVmm Vmm, GpuMethodCall MethCall)
{ {
Profile.Begin(Profiles.GPU.EngineP2mf.Execute);
//TODO: Some registers and copy modes are still not implemented. //TODO: Some registers and copy modes are still not implemented.
int Control = MethCall.Argument; int Control = MethCall.Argument;
@ -97,6 +105,8 @@ namespace Ryujinx.Graphics.Graphics3d
CopySize = LineLengthIn * LineCount; CopySize = LineLengthIn * LineCount;
Buffer = new byte[CopySize]; Buffer = new byte[CopySize];
Profile.End(Profiles.GPU.EngineP2mf.Execute);
} }
private void PushData(NvGpuVmm Vmm, GpuMethodCall MethCall) private void PushData(NvGpuVmm Vmm, GpuMethodCall MethCall)
@ -106,6 +116,8 @@ namespace Ryujinx.Graphics.Graphics3d
return; return;
} }
Profile.Begin(Profiles.GPU.EngineP2mf.PushData);
for (int Shift = 0; Shift < 32 && CopyOffset < CopySize; Shift += 8, CopyOffset++) for (int Shift = 0; Shift < 32 && CopyOffset < CopySize; Shift += 8, CopyOffset++)
{ {
Buffer[CopyOffset] = (byte)(MethCall.Argument >> Shift); Buffer[CopyOffset] = (byte)(MethCall.Argument >> Shift);
@ -134,6 +146,8 @@ namespace Ryujinx.Graphics.Graphics3d
Buffer = null; Buffer = null;
} }
Profile.End(Profiles.GPU.EngineP2mf.PushData);
} }
private long MakeInt64From2xInt32(NvGpuEngineP2mfReg Reg) private long MakeInt64From2xInt32(NvGpuEngineP2mfReg Reg)

View file

@ -192,6 +192,51 @@ namespace Ryujinx.Profiler
SessionGroup = "ConfigureState" 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() public static ProfileConfig ServiceCall = new ProfileConfig()