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:
LotP 2025-10-26 14:14:51 -05:00 committed by KeatonTheBot
parent e1b6cb71f8
commit 1bb1c7bba8
20 changed files with 295 additions and 232 deletions

View file

@ -159,6 +159,13 @@ namespace Ryujinx.Memory
AssertValidAddressAndSize(va, data.Length);
if (IsContiguousAndMapped(va, data.Length))
{
nuint pa = TranslateVirtualAddressChecked(va);
GetPhysicalAddressSpan(pa, data.Length).CopyTo(data);
}
int offset = 0, size;
if ((va & PageMask) != 0)
@ -182,6 +189,28 @@ namespace Ryujinx.Memory
}
}
public virtual bool TryReadUnsafe(ulong va, int length, out Span<byte> data)
{
if (!IsContiguousAndMapped(va, length))
{
data = default;
return false;
}
if (length == 0)
{
data = Span<byte>.Empty;
return true;
}
AssertValidAddressAndSize(va, length);
nuint pa = TranslateVirtualAddressChecked(va);
data = GetPhysicalAddressSpan(pa, length);
return true;
}
public virtual T ReadTracked<T>(ulong va) where T : unmanaged
{
SignalMemoryTracking(va, (ulong)Unsafe.SizeOf<T>(), false);