mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-09-24 03:00:06 +02:00
gpu allocation optimizations
ObjectPool now uses ConcurrentBag instead if ConcurrentStack, as it has a smaller memory footprint. Fix compiler warnings related to Audio Command Pools. Switch gpu command initialization to use pointers, that way skipping the allocation of the command which is unnecessary. Skip byte array allocation in Ioctl2/3 if it isn't needed (if the source data is all continuous we don't need to copy it to make it continuous).
This commit is contained in:
@@ -8,11 +8,11 @@ namespace Ryujinx.Common
|
||||
where T : class
|
||||
{
|
||||
private int _size = size;
|
||||
private readonly ConcurrentStack<T> _items = new();
|
||||
private readonly ConcurrentBag<T> _items = new();
|
||||
|
||||
public T Allocate()
|
||||
{
|
||||
bool success = _items.TryPop(out T instance);
|
||||
bool success = _items.TryTake(out T instance);
|
||||
|
||||
if (!success)
|
||||
{
|
||||
@@ -26,7 +26,7 @@ namespace Ryujinx.Common
|
||||
{
|
||||
if (_size < 0 || _items.Count < _size)
|
||||
{
|
||||
_items.Push(obj);
|
||||
_items.Add(obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user