|
@@ -324,9 +324,27 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|
|
/// <param name="rangeAction">The action to call for each modified range</param>
|
|
/// <param name="rangeAction">The action to call for each modified range</param>
|
|
|
public void ReregisterRanges(Action<ulong, ulong> rangeAction)
|
|
public void ReregisterRanges(Action<ulong, ulong> rangeAction)
|
|
|
{
|
|
{
|
|
|
|
|
+ ref var ranges = ref ThreadStaticArray<BufferModifiedRange>.Get();
|
|
|
|
|
+
|
|
|
|
|
+ // Range list must be consistent for this operation.
|
|
|
|
|
+ lock (_lock)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (ranges.Length < Count)
|
|
|
|
|
+ {
|
|
|
|
|
+ Array.Resize(ref ranges, Count);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ int i = 0;
|
|
|
|
|
+ foreach (BufferModifiedRange range in this)
|
|
|
|
|
+ {
|
|
|
|
|
+ ranges[i++] = range;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
ulong currentSync = _context.SyncNumber;
|
|
ulong currentSync = _context.SyncNumber;
|
|
|
- foreach (BufferModifiedRange range in this)
|
|
|
|
|
|
|
+ for (int i = 0; i < Count; i++)
|
|
|
{
|
|
{
|
|
|
|
|
+ BufferModifiedRange range = ranges[i];
|
|
|
if (range.SyncNumber != currentSync)
|
|
if (range.SyncNumber != currentSync)
|
|
|
{
|
|
{
|
|
|
rangeAction(range.Address, range.Size);
|
|
rangeAction(range.Address, range.Size);
|