aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Memory/Buffer.cs
diff options
context:
space:
mode:
authorgdk <gab.dark.100@gmail.com>2019-10-26 23:41:01 -0300
committerThog <thog@protonmail.com>2020-01-09 02:13:00 +0100
commitf2e84ff566b824aeb5158fa8432d7b26e2f94a09 (patch)
tree01e8c99340f5f3bc9715c75fe5bdce9a20d64703 /Ryujinx.Graphics.Gpu/Memory/Buffer.cs
parent8cba252b238ee6cf6599ad2fc57793e6f76c5e2e (diff)
Flush buffers on copies
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Memory/Buffer.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Memory/Buffer.cs11
1 files changed, 11 insertions, 0 deletions
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));