mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-06-28 06:46:24 +02:00
refactor: use Spans for aligned buffer creation
This commit is contained in:
parent
ce438f7276
commit
fe5b6ad7c7
3 changed files with 32 additions and 28 deletions
|
@ -110,7 +110,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
ulong size,
|
||||
BufferStage stage,
|
||||
bool sparseCompatible,
|
||||
IEnumerable<RangeItem<Buffer>> baseBuffers = null)
|
||||
ReadOnlySpan<RangeItem<Buffer>> baseBuffers)
|
||||
{
|
||||
_context = context;
|
||||
_physicalMemory = physicalMemory;
|
||||
|
@ -126,21 +126,22 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
|
||||
_useGranular = size > GranularBufferThreshold;
|
||||
|
||||
IEnumerable<IRegionHandle> baseHandles = null;
|
||||
List<IRegionHandle> baseHandles = null;
|
||||
|
||||
if (baseBuffers != null)
|
||||
if (!baseBuffers.IsEmpty)
|
||||
{
|
||||
baseHandles = baseBuffers.SelectMany(buffer =>
|
||||
baseHandles = new List<IRegionHandle>();
|
||||
foreach (RangeItem<Buffer> buffer in baseBuffers)
|
||||
{
|
||||
if (buffer.Value._useGranular)
|
||||
{
|
||||
return buffer.Value._memoryTrackingGranular.GetHandles();
|
||||
baseHandles.AddRange((buffer.Value._memoryTrackingGranular.GetHandles()));
|
||||
}
|
||||
else
|
||||
{
|
||||
return Enumerable.Repeat(buffer.Value._memoryTracking, 1);
|
||||
baseHandles.Add(buffer.Value._memoryTracking);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (_useGranular)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue