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:
riperiperi 2021-10-07 00:00:56 +01:00
parent ecc64c934d
commit c61c1ea898
2 changed files with 31 additions and 11 deletions

View file

@ -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);
}
}
}