From fff48bb45a197e4c1307340112cfed7fd45f5a83 Mon Sep 17 00:00:00 2001 From: riperiperi Date: Mon, 4 Oct 2021 19:38:59 +0100 Subject: Smaller initial size for ModifiedRangeList & directly inherit range list (#2663) This fixes a potential regression with the new range list changes, where the cost for creating new ones would be rather large due to creating a 1024 size array. Also reduces cost for range list inheritance by using the first existing range list as a base, rather than creating a new one then adding both lists to it. The growth size for the RangeList is now identical to its initial size. Every 32 elements was probably a little too common - now it is 1024 for most things and 8 for the buffer modified range list. The Unmapped and SyncMethod methods have been changed to ensure that they behave properly if the range list is set null. Cleaned up a few calls to use the null-conditional operator. --- Ryujinx.Graphics.Gpu/Memory/BufferModifiedRangeList.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Ryujinx.Graphics.Gpu/Memory/BufferModifiedRangeList.cs') diff --git a/Ryujinx.Graphics.Gpu/Memory/BufferModifiedRangeList.cs b/Ryujinx.Graphics.Gpu/Memory/BufferModifiedRangeList.cs index 63227431..84cf0dd8 100644 --- a/Ryujinx.Graphics.Gpu/Memory/BufferModifiedRangeList.cs +++ b/Ryujinx.Graphics.Gpu/Memory/BufferModifiedRangeList.cs @@ -60,6 +60,8 @@ namespace Ryujinx.Graphics.Gpu.Memory /// class BufferModifiedRangeList : RangeList { + private const int BackingInitialSize = 8; + private GpuContext _context; private object _lock = new object(); @@ -68,7 +70,7 @@ namespace Ryujinx.Graphics.Gpu.Memory /// Creates a new instance of a modified range list. /// /// GPU context that the buffer range list belongs to - public BufferModifiedRangeList(GpuContext context) + public BufferModifiedRangeList(GpuContext context) : base(BackingInitialSize) { _context = context; } -- cgit v1.2.3