fix inherited buffers still syncing

when a buffer with a scheduled sync is inherited the new buffer automatically schedules itself, but doesn't unschedule the old buffer.
combining the reuse of buffer ranges with the old buffer still having a sync scheduled causes the old buffer to sometimes try to sync with ranges that extend beyond its bounds.
fix: stop syncing old buffers, the new buffers already sync the same areas.
This commit is contained in:
LotP1 2025-11-27 03:31:25 +01:00
parent 01f43cafea
commit 6e002bea07

View File

@ -90,6 +90,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
private readonly bool _useGranular; private readonly bool _useGranular;
private bool _syncActionRegistered; private bool _syncActionRegistered;
private bool _bufferInherited;
private int _referenceCount = 1; private int _referenceCount = 1;
@ -429,10 +430,13 @@ namespace Ryujinx.Graphics.Gpu.Memory
{ {
_syncActionRegistered = false; _syncActionRegistered = false;
if (_bufferInherited)
{
return true;
}
if (_useGranular) if (_useGranular)
{ {
_modifiedRanges?.GetRanges(Address, Size, _syncRangeAction); _modifiedRanges?.GetRanges(Address, Size, _syncRangeAction);
} }
else else
@ -456,6 +460,8 @@ namespace Ryujinx.Graphics.Gpu.Memory
/// <param name="from">The buffer to inherit from</param> /// <param name="from">The buffer to inherit from</param>
public void InheritModifiedRanges(Buffer from) public void InheritModifiedRanges(Buffer from)
{ {
from._bufferInherited = true;
if (from._modifiedRanges is { HasRanges: true }) if (from._modifiedRanges is { HasRanges: true })
{ {
if (from._syncActionRegistered && !_syncActionRegistered) if (from._syncActionRegistered && !_syncActionRegistered)