mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-23 17:01:21 -08:00
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.
This commit is contained in:
parent
ecc64c934d
commit
c61c1ea898
@ -299,24 +299,28 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||||||
_syncActionRegistered = true;
|
_syncActionRegistered = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Action<ulong, ulong> registerRangeAction = (ulong address, ulong size) =>
|
||||||
|
{
|
||||||
|
if (_useGranular)
|
||||||
|
{
|
||||||
|
_memoryTrackingGranular.RegisterAction(address, size, _externalFlushDelegate);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_memoryTracking.RegisterAction(_externalFlushDelegate);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (_modifiedRanges == null)
|
if (_modifiedRanges == null)
|
||||||
{
|
{
|
||||||
_modifiedRanges = from._modifiedRanges;
|
_modifiedRanges = from._modifiedRanges;
|
||||||
|
_modifiedRanges.ReregisterRanges(registerRangeAction);
|
||||||
|
|
||||||
from._modifiedRanges = null;
|
from._modifiedRanges = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_modifiedRanges.InheritRanges(from._modifiedRanges, (ulong address, ulong size) =>
|
_modifiedRanges.InheritRanges(from._modifiedRanges, registerRangeAction);
|
||||||
{
|
|
||||||
if (_useGranular)
|
|
||||||
{
|
|
||||||
_memoryTrackingGranular.RegisterAction(address, size, _externalFlushDelegate);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_memoryTracking.RegisterAction(_externalFlushDelegate);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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)
|
private void ClearPart(BufferModifiedRange overlap, ulong address, ulong endAddress)
|
||||||
{
|
{
|
||||||
Remove(overlap);
|
Remove(overlap);
|
||||||
|
Loading…
Reference in New Issue
Block a user