From f2e84ff566b824aeb5158fa8432d7b26e2f94a09 Mon Sep 17 00:00:00 2001 From: gdk Date: Sat, 26 Oct 2019 23:41:01 -0300 Subject: Flush buffers on copies --- Ryujinx.Graphics.Gpu/Memory/Buffer.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Ryujinx.Graphics.Gpu/Memory/Buffer.cs') diff --git a/Ryujinx.Graphics.Gpu/Memory/Buffer.cs b/Ryujinx.Graphics.Gpu/Memory/Buffer.cs index 6f904d0f..e37fbc0f 100644 --- a/Ryujinx.Graphics.Gpu/Memory/Buffer.cs +++ b/Ryujinx.Graphics.Gpu/Memory/Buffer.cs @@ -9,6 +9,8 @@ namespace Ryujinx.Graphics.Gpu.Memory private IBuffer _buffer; + public IBuffer HostBuffer => _buffer; + public ulong Address { get; } public ulong Size { get; } @@ -86,6 +88,15 @@ namespace Ryujinx.Graphics.Gpu.Memory _buffer.CopyTo(destination._buffer, 0, dstOffset, (int)Size); } + public void Flush(ulong address, ulong size) + { + int offset = (int)(address - Address); + + byte[] data = _buffer.GetData(offset, (int)size); + + _context.PhysicalMemory.Write(address, data); + } + public void Invalidate() { _buffer.SetData(0, _context.PhysicalMemory.Read(Address, Size)); -- cgit v1.2.3