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
|
@ -57,7 +57,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
/// <param name="parent">Parent buffer</param>
|
||||
/// <param name="stage">Initial buffer stage</param>
|
||||
/// <param name="baseBuffers">Buffers to inherit state from</param>
|
||||
public BufferBackingState(GpuContext context, Buffer parent, BufferStage stage, IEnumerable<RangeItem<Buffer>> baseBuffers = null)
|
||||
public BufferBackingState(GpuContext context, Buffer parent, BufferStage stage, ReadOnlySpan<RangeItem<Buffer>> baseBuffers)
|
||||
{
|
||||
_size = (int)parent.Size;
|
||||
_systemMemoryType = context.Capabilities.MemoryType;
|
||||
|
@ -73,7 +73,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
|
||||
BufferStage storageFlags = stage & BufferStage.StorageMask;
|
||||
|
||||
if (parent.Size > DeviceLocalSizeThreshold && baseBuffers == null)
|
||||
if (parent.Size > DeviceLocalSizeThreshold && baseBuffers.IsEmpty)
|
||||
{
|
||||
_desiredType = BufferBackingType.DeviceMemory;
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
// TODO: Might be nice to force atomic access to be device local for any stage.
|
||||
}
|
||||
|
||||
if (baseBuffers != null)
|
||||
if (!baseBuffers.IsEmpty)
|
||||
{
|
||||
foreach (RangeItem<Buffer> buffer in baseBuffers)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue