From e777e9d9ffedb78d348fcf24df6f9b3c924a6178 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Tue, 11 Dec 2018 04:22:01 +0100 Subject: [PATCH] Better fast cache removal Remove only the respective key from the fast cache when a const buffer is modified with `CbData`. --- Ryujinx.Graphics/GpuResourceManager.cs | 4 ++-- Ryujinx.Graphics/Graphics3d/NvGpuEngine3d.cs | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Ryujinx.Graphics/GpuResourceManager.cs b/Ryujinx.Graphics/GpuResourceManager.cs index d46129516d..c60efdcc2e 100644 --- a/Ryujinx.Graphics/GpuResourceManager.cs +++ b/Ryujinx.Graphics/GpuResourceManager.cs @@ -132,9 +132,9 @@ namespace Ryujinx.Graphics } } - public void ClearPbCache(NvGpuBufferType Type) + public void RemoveFromPbCache(NvGpuBufferType Type, long Key) { - UploadedKeys[(int)Type].Clear(); + UploadedKeys[(int)Type].Remove(Key); } } } diff --git a/Ryujinx.Graphics/Graphics3d/NvGpuEngine3d.cs b/Ryujinx.Graphics/Graphics3d/NvGpuEngine3d.cs index 6fb038acb6..535be3bc5b 100644 --- a/Ryujinx.Graphics/Graphics3d/NvGpuEngine3d.cs +++ b/Ryujinx.Graphics/Graphics3d/NvGpuEngine3d.cs @@ -934,13 +934,15 @@ namespace Ryujinx.Graphics.Graphics3d { long Position = MakeInt64From2xInt32(NvGpuEngine3dReg.ConstBufferAddress); + long Key = Vmm.GetPhysicalAddress(Position); + int Offset = ReadRegister(NvGpuEngine3dReg.ConstBufferOffset); Vmm.WriteInt32(Position + Offset, MethCall.Argument); WriteRegister(NvGpuEngine3dReg.ConstBufferOffset, Offset + 4); - Gpu.ResourceManager.ClearPbCache(NvGpuBufferType.ConstBuffer); + Gpu.ResourceManager.RemoveFromPbCache(NvGpuBufferType.ConstBuffer, Key); } private void CbBind(NvGpuVmm Vmm, GpuMethodCall MethCall)