mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-11-19 17:21:15 +01:00
Memory Changes 3.2
Fixes a few crashes: - fixes a crash related to waking threads (priorities were wrong). - fixes a crash from reusing the SetRenderTargets texture array (left-over data causing issues). - fixes a mistake and an oversight in the buffer system. - buffers were getting updated wrong causing bad data to be stored or some times cut. - modified ranges would extend past their old buffers, crashing on syncs. Old buffers are now skipped as the new buffers already sync instead. Introduces pooling in a few more places to increase memory efficiency. simplified RangeList item logic. - removed RangeItem by making all the range objects use the I(NonOverlapping)Range interface. - BufferCache class no longer locks its RangeList, as the list is only ever accessed synchronously. Small change to how keyboard snapshots are stored. Increase ThreadedRenderer SpanPool size to fit slightly more data (4MB -> 8MB).
This commit is contained in:
1 parent
75220096e7
commit
c6deb3800f
37 files changed
+561
-686
No files matched your search
@@ -19,6 +19,9 @@ namespace Ryujinx.Horizon.Sdk.OsTypes.Impl
|
||||
private int _waitingThreadHandle;
|
||||
|
||||
private MultiWaitHolderBase _signaledHolder;
|
||||
|
||||
ObjectPool<int[]> _objectHandlePool = new(() => new int[64]);
|
||||
ObjectPool<MultiWaitHolderBase[]> _objectPool = new(() => new MultiWaitHolderBase[64]);
|
||||
|
||||
public long CurrentTime { get; private set; }
|
||||
|
||||
@@ -76,11 +79,15 @@ namespace Ryujinx.Horizon.Sdk.OsTypes.Impl
|
||||
|
||||
private MultiWaitHolderBase WaitAnyHandleImpl(bool infinite, long timeout)
|
||||
{
|
||||
Span<int> objectHandles = new int[64];
|
||||
int[] objectHandles = _objectHandlePool.Allocate();
|
||||
Span<int> objectHandlesSpan = objectHandles;
|
||||
objectHandlesSpan.Clear();
|
||||
|
||||
Span<MultiWaitHolderBase> objects = new MultiWaitHolderBase[64];
|
||||
MultiWaitHolderBase[] objects = _objectPool.Allocate();
|
||||
Span<MultiWaitHolderBase> objectsSpan = objects;
|
||||
objectsSpan.Clear();
|
||||
|
||||
int count = FillObjectsArray(objectHandles, objects);
|
||||
int count = FillObjectsArray(objectHandlesSpan, objectsSpan);
|
||||
|
||||
long endTime = infinite ? long.MaxValue : PerformanceCounter.ElapsedMilliseconds * 1000000;
|
||||
|
||||
@@ -98,7 +105,7 @@ namespace Ryujinx.Horizon.Sdk.OsTypes.Impl
|
||||
}
|
||||
else
|
||||
{
|
||||
index = WaitSynchronization(objectHandles[..count], minTimeout);
|
||||
index = WaitSynchronization(objectHandlesSpan[..count], minTimeout);
|
||||
|
||||
DebugUtil.Assert(index != WaitInvalid);
|
||||
}
|
||||
@@ -116,12 +123,18 @@ namespace Ryujinx.Horizon.Sdk.OsTypes.Impl
|
||||
{
|
||||
_signaledHolder = minTimeoutObject;
|
||||
|
||||
_objectHandlePool.Release(objectHandles);
|
||||
_objectPool.Release(objects);
|
||||
|
||||
return _signaledHolder;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_objectHandlePool.Release(objectHandles);
|
||||
_objectPool.Release(objects);
|
||||
|
||||
return null;
|
||||
}
|
||||
break;
|
||||
@@ -130,6 +143,9 @@ namespace Ryujinx.Horizon.Sdk.OsTypes.Impl
|
||||
{
|
||||
if (_signaledHolder != null)
|
||||
{
|
||||
_objectHandlePool.Release(objectHandles);
|
||||
_objectPool.Release(objects);
|
||||
|
||||
return _signaledHolder;
|
||||
}
|
||||
}
|
||||
@@ -137,8 +153,11 @@ namespace Ryujinx.Horizon.Sdk.OsTypes.Impl
|
||||
default:
|
||||
lock (_lock)
|
||||
{
|
||||
_signaledHolder = objects[index];
|
||||
_signaledHolder = objectsSpan[index];
|
||||
|
||||
_objectHandlePool.Release(objectHandles);
|
||||
_objectPool.Release(objects);
|
||||
|
||||
return _signaledHolder;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user