mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-04-22 14:42:54 +00:00
gpu allocation optimizations (ryubing/ryujinx!195)
See merge request ryubing/ryujinx!195
This commit is contained in:
@@ -123,15 +123,15 @@ namespace Ryujinx.HLE.HOS.Services.Nv
|
||||
return NvResult.InvalidSize;
|
||||
}
|
||||
|
||||
byte[] outputData = new byte[outputDataSize];
|
||||
|
||||
byte[] temp = new byte[inputDataSize];
|
||||
|
||||
context.Memory.Read(inputDataPosition, temp);
|
||||
|
||||
Buffer.BlockCopy(temp, 0, outputData, 0, temp.Length);
|
||||
|
||||
arguments = new Span<byte>(outputData);
|
||||
if (!context.Memory.TryReadUnsafe(inputDataPosition, (int)inputDataSize, out arguments))
|
||||
{
|
||||
arguments = new byte[inputDataSize];
|
||||
context.Memory.Read(inputDataPosition, arguments);
|
||||
}
|
||||
else
|
||||
{
|
||||
arguments = arguments.ToArray();
|
||||
}
|
||||
}
|
||||
else if (isWrite)
|
||||
{
|
||||
@@ -470,12 +470,12 @@ namespace Ryujinx.HLE.HOS.Services.Nv
|
||||
(ulong inlineInBufferPosition, ulong inlineInBufferSize) = context.Request.GetBufferType0x21(1);
|
||||
|
||||
errorCode = GetIoctlArgument(context, ioctlCommand, out Span<byte> arguments);
|
||||
|
||||
byte[] temp = new byte[inlineInBufferSize];
|
||||
|
||||
context.Memory.Read(inlineInBufferPosition, temp);
|
||||
|
||||
Span<byte> inlineInBuffer = new(temp);
|
||||
|
||||
if (!context.Memory.TryReadUnsafe(inlineInBufferPosition, (int)inlineInBufferSize, out Span<byte> inlineInBuffer))
|
||||
{
|
||||
inlineInBuffer = new byte[inlineInBufferSize];
|
||||
context.Memory.Read(inlineInBufferPosition, inlineInBuffer);
|
||||
}
|
||||
|
||||
if (errorCode == NvResult.Success)
|
||||
{
|
||||
@@ -519,12 +519,12 @@ namespace Ryujinx.HLE.HOS.Services.Nv
|
||||
(ulong inlineOutBufferPosition, ulong inlineOutBufferSize) = context.Request.GetBufferType0x22(1);
|
||||
|
||||
errorCode = GetIoctlArgument(context, ioctlCommand, out Span<byte> arguments);
|
||||
|
||||
byte[] temp = new byte[inlineOutBufferSize];
|
||||
|
||||
context.Memory.Read(inlineOutBufferPosition, temp);
|
||||
|
||||
Span<byte> inlineOutBuffer = new(temp);
|
||||
|
||||
if (!context.Memory.TryReadUnsafe(inlineOutBufferPosition, (int)inlineOutBufferSize, out Span<byte> inlineOutBuffer))
|
||||
{
|
||||
inlineOutBuffer = new byte[inlineOutBufferSize];
|
||||
context.Memory.Read(inlineOutBufferPosition, inlineOutBuffer);
|
||||
}
|
||||
|
||||
if (errorCode == NvResult.Success)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user