diff options
Diffstat (limited to 'src/Ryujinx.Graphics.Vulkan/MemoryAllocation.cs')
-rw-r--r-- | src/Ryujinx.Graphics.Vulkan/MemoryAllocation.cs | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/Ryujinx.Graphics.Vulkan/MemoryAllocation.cs b/src/Ryujinx.Graphics.Vulkan/MemoryAllocation.cs index 76de1296..3c98c417 100644 --- a/src/Ryujinx.Graphics.Vulkan/MemoryAllocation.cs +++ b/src/Ryujinx.Graphics.Vulkan/MemoryAllocation.cs @@ -7,6 +7,7 @@ namespace Ryujinx.Graphics.Vulkan { private readonly MemoryAllocatorBlockList _owner; private readonly MemoryAllocatorBlockList.Block _block; + private readonly HostMemoryAllocator _hostMemory; public DeviceMemory Memory { get; } public IntPtr HostPointer { get;} @@ -29,9 +30,30 @@ namespace Ryujinx.Graphics.Vulkan Size = size; } + public MemoryAllocation( + HostMemoryAllocator hostMemory, + DeviceMemory memory, + IntPtr hostPointer, + ulong offset, + ulong size) + { + _hostMemory = hostMemory; + Memory = memory; + HostPointer = hostPointer; + Offset = offset; + Size = size; + } + public void Dispose() { - _owner.Free(_block, Offset, Size); + if (_hostMemory != null) + { + _hostMemory.Free(Memory, Offset, Size); + } + else + { + _owner.Free(_block, Offset, Size); + } } } } |