aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorriperiperi <rhy3756547@hotmail.com>2021-10-07 00:00:56 +0100
committerriperiperi <rhy3756547@hotmail.com>2021-10-07 00:00:56 +0100
commitc61c1ea8980f0a97ea4d77a5465745d7103e2452 (patch)
treea0aff8887ba80f6d491e338e4a71bd341caa4c91
parentecc64c934da43f881c2821bc9bc52ee42e55af2f (diff)
Reregister flush actions when taking a buffer's modified range list.
Fixes a regression from #2663 where buffer flush would not happen after a resize. Specifically caused the world map in Yoshi's Crafted World to flash. I have other planned changes to this class so this might change soon, but this regression could affect a lot so it couldn't wait.
-rw-r--r--Ryujinx.Graphics.Gpu/Memory/Buffer.cs26
-rw-r--r--Ryujinx.Graphics.Gpu/Memory/BufferModifiedRangeList.cs16
2 files changed, 31 insertions, 11 deletions
diff --git a/Ryujinx.Graphics.Gpu/Memory/Buffer.cs b/Ryujinx.Graphics.Gpu/Memory/Buffer.cs
index 0eaf0123..81f70684 100644
--- a/Ryujinx.Graphics.Gpu/Memory/Buffer.cs
+++ b/Ryujinx.Graphics.Gpu/Memory/Buffer.cs
@@ -299,24 +299,28 @@ namespace Ryujinx.Graphics.Gpu.Memory
_syncActionRegistered = true;
}
+ Action<ulong, ulong> registerRangeAction = (ulong address, ulong size) =>
+ {
+ if (_useGranular)
+ {
+ _memoryTrackingGranular.RegisterAction(address, size, _externalFlushDelegate);
+ }
+ else
+ {
+ _memoryTracking.RegisterAction(_externalFlushDelegate);
+ }
+ };
+
if (_modifiedRanges == null)
{
_modifiedRanges = from._modifiedRanges;
+ _modifiedRanges.ReregisterRanges(registerRangeAction);
+
from._modifiedRanges = null;
}
else
{
- _modifiedRanges.InheritRanges(from._modifiedRanges, (ulong address, ulong size) =>
- {
- if (_useGranular)
- {
- _memoryTrackingGranular.RegisterAction(address, size, _externalFlushDelegate);
- }
- else
- {
- _memoryTracking.RegisterAction(_externalFlushDelegate);
- }
- });
+ _modifiedRanges.InheritRanges(from._modifiedRanges, registerRangeAction);
}
}
}
diff --git a/Ryujinx.Graphics.Gpu/Memory/BufferModifiedRangeList.cs b/Ryujinx.Graphics.Gpu/Memory/BufferModifiedRangeList.cs
index 84cf0dd8..faaccf13 100644
--- a/Ryujinx.Graphics.Gpu/Memory/BufferModifiedRangeList.cs
+++ b/Ryujinx.Graphics.Gpu/Memory/BufferModifiedRangeList.cs
@@ -318,6 +318,22 @@ namespace Ryujinx.Graphics.Gpu.Memory
}
}
+ /// <summary>
+ /// Calls the given action for modified ranges that aren't from the current sync number.
+ /// </summary>
+ /// <param name="rangeAction">The action to call for each modified range</param>
+ public void ReregisterRanges(Action<ulong, ulong> rangeAction)
+ {
+ ulong currentSync = _context.SyncNumber;
+ foreach (BufferModifiedRange range in this)
+ {
+ if (range.SyncNumber != currentSync)
+ {
+ rangeAction(range.Address, range.Size);
+ }
+ }
+ }
+
private void ClearPart(BufferModifiedRange overlap, ulong address, ulong endAddress)
{
Remove(overlap);