mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-09-22 02:31:12 +02:00
Memory changes 2.2
A few more internal changes to the RangeList systems. * No longer using a QuickAccess dictionary. * The performance of the dictionary wasn't much faster than just doing binary searches. * Using just binary searches allows us to take advantage of span and array returns as they're are faster than linked lists when iterating or copying the overlaps. Small code optimizations. Fixes a few leftover crashes.
This commit is contained in:
@@ -96,7 +96,7 @@ namespace Ryujinx.Graphics.Device
|
||||
uint alignedOffset = index * RegisterSize;
|
||||
DebugWrite(alignedOffset, data);
|
||||
|
||||
GetRefIntAlignedUncheck(index) = data;
|
||||
SetIntAlignedUncheck(index, data);
|
||||
|
||||
_writeCallbacks[index]?.Invoke(data);
|
||||
}
|
||||
@@ -111,9 +111,7 @@ namespace Ryujinx.Graphics.Device
|
||||
uint alignedOffset = index * RegisterSize;
|
||||
DebugWrite(alignedOffset, data);
|
||||
|
||||
ref var storage = ref GetRefIntAlignedUncheck(index);
|
||||
changed = storage != data;
|
||||
storage = data;
|
||||
changed = SetIntAlignedUncheckChanged(index, data);
|
||||
|
||||
_writeCallbacks[index]?.Invoke(data);
|
||||
}
|
||||
@@ -153,5 +151,24 @@ namespace Ryujinx.Graphics.Device
|
||||
{
|
||||
return ref Unsafe.Add(ref Unsafe.As<TState, int>(ref State), (IntPtr)index);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void SetIntAlignedUncheck(ulong index, int data)
|
||||
{
|
||||
Unsafe.Add(ref Unsafe.As<TState, int>(ref State), (nint)index) = data;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private bool SetIntAlignedUncheckChanged(ulong index, int data)
|
||||
{
|
||||
ref int val = ref Unsafe.Add(ref Unsafe.As<TState, int>(ref State), (nint)index);
|
||||
if (val == data)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
val = data;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user