Profiled methods used by VertexEndGl

This commit is contained in:
Andy Adshead 2019-02-02 00:50:58 +00:00
commit 7f26dfdb64
2 changed files with 98 additions and 3 deletions

View file

@ -96,6 +96,8 @@ namespace Ryujinx.Graphics.Graphics3d
LockCaches(); LockCaches();
Profile.Begin(Profiles.GPU.Engine3d.ConfigureState);
GalPipelineState State = new GalPipelineState(); GalPipelineState State = new GalPipelineState();
SetFrameBuffer(State); SetFrameBuffer(State);
@ -108,6 +110,8 @@ namespace Ryujinx.Graphics.Graphics3d
SetColorMask(State); SetColorMask(State);
SetPrimitiveRestart(State); SetPrimitiveRestart(State);
Profile.End(Profiles.GPU.Engine3d.ConfigureState);
for (int FbIndex = 0; FbIndex < 8; FbIndex++) for (int FbIndex = 0; FbIndex < 8; FbIndex++)
{ {
SetFrameBuffer(Vmm, FbIndex); SetFrameBuffer(Vmm, FbIndex);
@ -148,6 +152,8 @@ namespace Ryujinx.Graphics.Graphics3d
private void ClearBuffers(NvGpuVmm Vmm, GpuMethodCall MethCall) private void ClearBuffers(NvGpuVmm Vmm, GpuMethodCall MethCall)
{ {
Profile.Begin(Profiles.GPU.Engine3d.ClearBuffers);
int Attachment = (MethCall.Argument >> 6) & 0xf; int Attachment = (MethCall.Argument >> 6) & 0xf;
GalClearBufferFlags Flags = (GalClearBufferFlags)(MethCall.Argument & 0x3f); GalClearBufferFlags Flags = (GalClearBufferFlags)(MethCall.Argument & 0x3f);
@ -173,10 +179,16 @@ namespace Ryujinx.Graphics.Graphics3d
Gpu.Renderer.Pipeline.ResetDepthMask(); Gpu.Renderer.Pipeline.ResetDepthMask();
Gpu.Renderer.Pipeline.ResetColorMask(Attachment); Gpu.Renderer.Pipeline.ResetColorMask(Attachment);
Profile.End(Profiles.GPU.Engine3d.ClearBuffers);
} }
private void SetFrameBuffer(NvGpuVmm Vmm, int FbIndex) private void SetFrameBuffer(NvGpuVmm Vmm, int FbIndex)
{ {
ProfileConfig profile = Profiles.GPU.Engine3d.SetFrameBuffer;
profile.SessionItem = FbIndex.ToString();
Profile.Begin(profile);
long VA = MakeInt64From2xInt32(NvGpuEngine3dReg.FrameBufferNAddress + FbIndex * 0x10); long VA = MakeInt64From2xInt32(NvGpuEngine3dReg.FrameBufferNAddress + FbIndex * 0x10);
int SurfFormat = ReadRegister(NvGpuEngine3dReg.FrameBufferNFormat + FbIndex * 0x10); int SurfFormat = ReadRegister(NvGpuEngine3dReg.FrameBufferNFormat + FbIndex * 0x10);
@ -185,6 +197,7 @@ namespace Ryujinx.Graphics.Graphics3d
{ {
Gpu.Renderer.RenderTarget.UnbindColor(FbIndex); Gpu.Renderer.RenderTarget.UnbindColor(FbIndex);
Profile.End(profile);
return; return;
} }
@ -220,6 +233,8 @@ namespace Ryujinx.Graphics.Graphics3d
ViewportHeight = VpH; ViewportHeight = VpH;
Gpu.Renderer.RenderTarget.SetViewport(FbIndex, VpX, VpY, VpW, VpH); Gpu.Renderer.RenderTarget.SetViewport(FbIndex, VpX, VpY, VpW, VpH);
Profile.End(profile);
} }
private void SetFrameBuffer(GalPipelineState State) private void SetFrameBuffer(GalPipelineState State)
@ -241,6 +256,8 @@ namespace Ryujinx.Graphics.Graphics3d
private void SetZeta(NvGpuVmm Vmm) private void SetZeta(NvGpuVmm Vmm)
{ {
Profile.Begin(Profiles.GPU.Engine3d.SetZeta);
long VA = MakeInt64From2xInt32(NvGpuEngine3dReg.ZetaAddress); long VA = MakeInt64From2xInt32(NvGpuEngine3dReg.ZetaAddress);
int ZetaFormat = ReadRegister(NvGpuEngine3dReg.ZetaFormat); int ZetaFormat = ReadRegister(NvGpuEngine3dReg.ZetaFormat);
@ -257,6 +274,7 @@ namespace Ryujinx.Graphics.Graphics3d
{ {
Gpu.Renderer.RenderTarget.UnbindZeta(); Gpu.Renderer.RenderTarget.UnbindZeta();
Profile.End(Profiles.GPU.Engine3d.SetZeta);
return; return;
} }
@ -270,10 +288,14 @@ namespace Ryujinx.Graphics.Graphics3d
GalImage Image = new GalImage(Width, Height, 1, GobBlockHeight, Layout, Format); GalImage Image = new GalImage(Width, Height, 1, GobBlockHeight, Layout, Format);
Gpu.ResourceManager.SendZetaBuffer(Vmm, Key, Image); Gpu.ResourceManager.SendZetaBuffer(Vmm, Key, Image);
Profile.End(Profiles.GPU.Engine3d.SetZeta);
} }
private long[] UploadShaders(NvGpuVmm Vmm) private long[] UploadShaders(NvGpuVmm Vmm)
{ {
Profile.Begin(Profiles.GPU.Engine3d.UploadShaders);
long[] Keys = new long[5]; long[] Keys = new long[5];
long BasePosition = MakeInt64From2xInt32(NvGpuEngine3dReg.ShaderAddress); long BasePosition = MakeInt64From2xInt32(NvGpuEngine3dReg.ShaderAddress);
@ -331,6 +353,8 @@ namespace Ryujinx.Graphics.Graphics3d
Gpu.Renderer.Shader.Bind(Key); Gpu.Renderer.Shader.Bind(Key);
} }
Profile.End(Profiles.GPU.Engine3d.UploadShaders);
return Keys; return Keys;
} }
@ -560,6 +584,8 @@ namespace Ryujinx.Graphics.Graphics3d
private void UploadTextures(NvGpuVmm Vmm, GalPipelineState State, long[] Keys) private void UploadTextures(NvGpuVmm Vmm, GalPipelineState State, long[] Keys)
{ {
Profile.Begin(Profiles.GPU.Engine3d.UploadTextures);
long BaseShPosition = MakeInt64From2xInt32(NvGpuEngine3dReg.ShaderAddress); long BaseShPosition = MakeInt64From2xInt32(NvGpuEngine3dReg.ShaderAddress);
int TextureCbIndex = ReadRegister(NvGpuEngine3dReg.TextureCbIndex); int TextureCbIndex = ReadRegister(NvGpuEngine3dReg.TextureCbIndex);
@ -599,6 +625,8 @@ namespace Ryujinx.Graphics.Graphics3d
Gpu.Renderer.Texture.Bind(Key, Index, Image); Gpu.Renderer.Texture.Bind(Key, Index, Image);
Gpu.Renderer.Texture.SetSampler(Sampler); Gpu.Renderer.Texture.SetSampler(Sampler);
} }
Profile.End(Profiles.GPU.Engine3d.UploadTextures);
} }
private (long, GalImage, GalTextureSampler) UploadTexture(NvGpuVmm Vmm, int TextureHandle) private (long, GalImage, GalTextureSampler) UploadTexture(NvGpuVmm Vmm, int TextureHandle)
@ -610,6 +638,8 @@ namespace Ryujinx.Graphics.Graphics3d
return (0, default(GalImage), default(GalTextureSampler)); return (0, default(GalImage), default(GalTextureSampler));
} }
Profile.Begin(Profiles.GPU.Engine3d.UploadTexture);
bool LinkedTsc = ReadRegisterBool(NvGpuEngine3dReg.LinkedTsc); bool LinkedTsc = ReadRegisterBool(NvGpuEngine3dReg.LinkedTsc);
int TicIndex = (TextureHandle >> 0) & 0xfffff; int TicIndex = (TextureHandle >> 0) & 0xfffff;
@ -641,17 +671,23 @@ namespace Ryujinx.Graphics.Graphics3d
if (Key == -1) if (Key == -1)
{ {
Profile.End(Profiles.GPU.Engine3d.UploadTexture);
//FIXME: Shouldn't ignore invalid addresses. //FIXME: Shouldn't ignore invalid addresses.
return (0, default(GalImage), default(GalTextureSampler)); return (0, default(GalImage), default(GalTextureSampler));
} }
Gpu.ResourceManager.SendTexture(Vmm, Key, Image); Gpu.ResourceManager.SendTexture(Vmm, Key, Image);
Profile.End(Profiles.GPU.Engine3d.UploadTexture);
return (Key, Image, Sampler); return (Key, Image, Sampler);
} }
private void UploadConstBuffers(NvGpuVmm Vmm, GalPipelineState State, long[] Keys) private void UploadConstBuffers(NvGpuVmm Vmm, GalPipelineState State, long[] Keys)
{ {
Profile.Begin(Profiles.GPU.Engine3d.UploadConstBuffers);
for (int Stage = 0; Stage < Keys.Length; Stage++) for (int Stage = 0; Stage < Keys.Length; Stage++)
{ {
foreach (ShaderDeclInfo DeclInfo in Gpu.Renderer.Shader.GetConstBufferUsage(Keys[Stage])) foreach (ShaderDeclInfo DeclInfo in Gpu.Renderer.Shader.GetConstBufferUsage(Keys[Stage]))
@ -680,10 +716,14 @@ namespace Ryujinx.Graphics.Graphics3d
State.ConstBufferKeys[Stage][DeclInfo.Cbuf] = Key; State.ConstBufferKeys[Stage][DeclInfo.Cbuf] = Key;
} }
} }
Profile.End(Profiles.GPU.Engine3d.UploadConstBuffers);
} }
private void UploadVertexArrays(NvGpuVmm Vmm, GalPipelineState State) private void UploadVertexArrays(NvGpuVmm Vmm, GalPipelineState State)
{ {
Profile.Begin(Profiles.GPU.Engine3d.UploadVertexArrays);
long IbPosition = MakeInt64From2xInt32(NvGpuEngine3dReg.IndexArrayAddress); long IbPosition = MakeInt64From2xInt32(NvGpuEngine3dReg.IndexArrayAddress);
long IboKey = Vmm.GetPhysicalAddress(IbPosition); long IboKey = Vmm.GetPhysicalAddress(IbPosition);
@ -895,6 +935,8 @@ namespace Ryujinx.Graphics.Graphics3d
State.VertexBindings[Index].Divisor = VertexDivisor; State.VertexBindings[Index].Divisor = VertexDivisor;
State.VertexBindings[Index].Attribs = Attribs[Index].ToArray(); State.VertexBindings[Index].Attribs = Attribs[Index].ToArray();
} }
Profile.End(Profiles.GPU.Engine3d.UploadVertexArrays);
} }
private void DispatchRender(NvGpuVmm Vmm, GalPipelineState State) private void DispatchRender(NvGpuVmm Vmm, GalPipelineState State)

View file

@ -96,9 +96,62 @@ namespace Ryujinx.Profiler
{ {
public static ProfileConfig VertexEnd = new ProfileConfig() public static ProfileConfig VertexEnd = new ProfileConfig()
{ {
Category = "GPU", Category = "GPU.Engine3D",
SessionGroup = "Engine3D", SessionGroup = "VertexEnd"
SessionItem = "VertexEnd" };
public static ProfileConfig ClearBuffers = new ProfileConfig()
{
Category = "GPU.Engine3D",
SessionGroup = "ClearBuffers"
};
public static ProfileConfig SetFrameBuffer = new ProfileConfig()
{
Category = "GPU.Engine3D",
SessionGroup = "SetFrameBuffer",
};
public static ProfileConfig SetZeta = new ProfileConfig()
{
Category = "GPU.Engine3D",
SessionGroup = "SetZeta"
};
public static ProfileConfig UploadShaders = new ProfileConfig()
{
Category = "GPU.Engine3D",
SessionGroup = "UploadShaders"
};
public static ProfileConfig UploadTextures = new ProfileConfig()
{
Category = "GPU.Engine3D",
SessionGroup = "UploadTextures"
};
public static ProfileConfig UploadTexture = new ProfileConfig()
{
Category = "GPU.Engine3D",
SessionGroup = "UploadTexture"
};
public static ProfileConfig UploadConstBuffers = new ProfileConfig()
{
Category = "GPU.Engine3D",
SessionGroup = "UploadConstBuffers"
};
public static ProfileConfig UploadVertexArrays = new ProfileConfig()
{
Category = "GPU.Engine3D",
SessionGroup = "UploadVertexArrays"
};
public static ProfileConfig ConfigureState = new ProfileConfig()
{
Category = "GPU.Engine3D",
SessionGroup = "ConfigureState"
}; };
} }
} }