Flush buffers on copies

This commit is contained in:
gdk 2019-10-26 23:41:01 -03:00 committed by Thog
parent 8cba252b23
commit f2e84ff566
3 changed files with 28 additions and 21 deletions

View file

@ -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));