eliminate temporary buffer allocations
This commit is contained in:
parent
dbac05fcc2
commit
73f3e9725c
2 changed files with 4 additions and 6 deletions
|
@ -1,7 +1,6 @@
|
||||||
using Ryujinx.Common.Memory;
|
using Ryujinx.Common.Memory;
|
||||||
using Ryujinx.Memory;
|
using Ryujinx.Memory;
|
||||||
using System;
|
using System;
|
||||||
using System.Buffers;
|
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
@ -145,9 +144,9 @@ namespace Ryujinx.Graphics.Device
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IMemoryOwner<byte> memoryOwner = ByteMemoryPool.Rent(size);
|
MemoryOwner<byte> memoryOwner = MemoryOwner<byte>.Rent(size);
|
||||||
|
|
||||||
GetSpan(va, size).CopyTo(memoryOwner.Memory.Span);
|
ReadImpl(va, memoryOwner.Span);
|
||||||
|
|
||||||
return new WritableRegion(this, va, memoryOwner, tracked: true);
|
return new WritableRegion(this, va, memoryOwner, tracked: true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ using Ryujinx.Common.Memory;
|
||||||
using Ryujinx.Memory;
|
using Ryujinx.Memory;
|
||||||
using Ryujinx.Memory.Range;
|
using Ryujinx.Memory.Range;
|
||||||
using System;
|
using System;
|
||||||
using System.Buffers;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
@ -242,9 +241,9 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IMemoryOwner<byte> memoryOwner = ByteMemoryPool.Rent(size);
|
MemoryOwner<byte> memoryOwner = MemoryOwner<byte>.Rent(size);
|
||||||
|
|
||||||
GetSpan(va, size).CopyTo(memoryOwner.Memory.Span);
|
ReadImpl(va, memoryOwner.Span, tracked);
|
||||||
|
|
||||||
return new WritableRegion(this, va, memoryOwner, tracked);
|
return new WritableRegion(this, va, memoryOwner, tracked);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue