Compare commits

..

2 Commits

Author SHA1 Message Date
LotP
2c0977f6b3 fix pre-action crash (ryubing/ryujinx!236)
See merge request ryubing/ryujinx!236
2025-12-12 14:28:54 -06:00
LotP
3a593b6084 Fix kaddressarbiter crash (ryubing/ryujinx!235)
See merge request ryubing/ryujinx!235
2025-12-06 20:16:43 -06:00
6 changed files with 26 additions and 7 deletions

1
.gitignore vendored
View File

@ -100,6 +100,7 @@ DocProject/Help/html
# Click-Once directory # Click-Once directory
publish/ publish/
RyubingMaintainerTools/
# Publish Web Output # Publish Web Output
*.Publish.xml *.Publish.xml

View File

@ -404,9 +404,12 @@ namespace Ryujinx.Graphics.Gpu
if (force || _pendingSync || (syncPoint && SyncpointActions.Count > 0)) if (force || _pendingSync || (syncPoint && SyncpointActions.Count > 0))
{ {
foreach (ISyncActionHandler action in SyncActions) for (int i = 0; i < SyncActions.Count; i++)
{ {
action.SyncPreAction(syncPoint); if (SyncActions[i].SyncPreAction(syncPoint))
{
SyncActions.RemoveAt(i--);
}
} }
foreach (ISyncActionHandler action in SyncpointActions) foreach (ISyncActionHandler action in SyncpointActions)

View File

@ -411,7 +411,7 @@ namespace Ryujinx.Graphics.Gpu.Image
/// flushes often enough, which is determined by the flush balance. /// flushes often enough, which is determined by the flush balance.
/// </summary> /// </summary>
/// <inheritdoc/> /// <inheritdoc/>
public void SyncPreAction(bool syncpoint) public bool SyncPreAction(bool syncpoint)
{ {
if (syncpoint || NextSyncCopies()) if (syncpoint || NextSyncCopies())
{ {
@ -421,6 +421,8 @@ namespace Ryujinx.Graphics.Gpu.Image
_registeredBufferSync = _modifiedSync; _registeredBufferSync = _modifiedSync;
} }
} }
return true;
} }
/// <summary> /// <summary>

View File

@ -393,11 +393,16 @@ namespace Ryujinx.Graphics.Gpu.Memory
/// This will copy any buffer ranges designated for pre-flushing. /// This will copy any buffer ranges designated for pre-flushing.
/// </summary> /// </summary>
/// <param name="syncpoint">True if the action is a guest syncpoint</param> /// <param name="syncpoint">True if the action is a guest syncpoint</param>
public void SyncPreAction(bool syncpoint) public bool SyncPreAction(bool syncpoint)
{ {
if (_bufferInherited)
{
return true;
}
if (_referenceCount == 0) if (_referenceCount == 0)
{ {
return; return false;
} }
if (BackingState.ShouldChangeBacking()) if (BackingState.ShouldChangeBacking())
@ -414,6 +419,8 @@ namespace Ryujinx.Graphics.Gpu.Memory
_modifiedRanges?.GetRangesAtSync(Address, Size, _context.SyncNumber, _syncPreRangeAction); _modifiedRanges?.GetRangesAtSync(Address, Size, _context.SyncNumber, _syncPreRangeAction);
} }
} }
return false;
} }
void SyncPreRangeAction(ulong address, ulong size) void SyncPreRangeAction(ulong address, ulong size)

View File

@ -17,6 +17,6 @@ namespace Ryujinx.Graphics.Gpu.Synchronization
/// Action to be performed immediately before sync is created. /// Action to be performed immediately before sync is created.
/// </summary> /// </summary>
/// <param name="syncpoint">True if the action is a guest syncpoint</param> /// <param name="syncpoint">True if the action is a guest syncpoint</param>
void SyncPreAction(bool syncpoint) { } bool SyncPreAction(bool syncpoint) { return true; }
} }
} }

View File

@ -529,7 +529,13 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
// The value is decremented if the number of threads waiting is less // The value is decremented if the number of threads waiting is less
// or equal to the Count of threads to be signaled, or Count is zero // or equal to the Count of threads to be signaled, or Count is zero
// or negative. It is incremented if there are no threads waiting. // or negative. It is incremented if there are no threads waiting.
int waitingCount = _arbiterThreads[address].Count; int waitingCount = 0;
if (_arbiterThreads.TryGetValue(address, out List<KThread> threads))
{
waitingCount = threads.Count;
}
if (waitingCount > 0) if (waitingCount > 0)
{ {