From 65778a6b78ab8bde4090478482227e40c551db4d Mon Sep 17 00:00:00 2001 From: riperiperi Date: Thu, 24 Nov 2022 14:50:15 +0000 Subject: GPU: Don't trigger uploads for redundant buffer updates (#3828) * Initial implementation * Actually do The Thing * Add remark about performance to IVirtualMemoryManager --- Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs') diff --git a/Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs b/Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs index 155cba0f..051838f1 100644 --- a/Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs +++ b/Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs @@ -242,6 +242,19 @@ namespace Ryujinx.Graphics.Gpu.Memory WriteImpl(range, data, _cpuMemory.WriteUntracked); } + /// + /// Writes data to the application process, returning false if the data was not changed. + /// This triggers read memory tracking, as a redundancy check would be useless if the data is not up to date. + /// + /// The memory manager can return that memory has changed when it hasn't to avoid expensive data copies. + /// Address to write into + /// Data to be written + /// True if the data was changed, false otherwise + public bool WriteWithRedundancyCheck(ulong address, ReadOnlySpan data) + { + return _cpuMemory.WriteWithRedundancyCheck(address, data); + } + private delegate void WriteCallback(ulong address, ReadOnlySpan data); /// -- cgit v1.2.3