Experimental performance improvements
This commit is contained in:
parent
80707f9311
commit
8a3eee19be
4 changed files with 36 additions and 3 deletions
|
@ -552,6 +552,39 @@ namespace ARMeilleure.Memory
|
|||
return data;
|
||||
}
|
||||
|
||||
public Span<byte> GetSpan(ulong address, ulong size)
|
||||
{
|
||||
if (IsContiguous(address, size))
|
||||
{
|
||||
return new Span<byte>((void*)Translate((long)address), (int)size);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ReadBytes((long)address, (long)size);
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsContiguous(ulong address, ulong size)
|
||||
{
|
||||
ulong endVa = (address + size + PageMask) & ~(ulong)PageMask;
|
||||
|
||||
address &= ~(ulong)PageMask;
|
||||
|
||||
int pages = (int)((endVa - address) / PageSize);
|
||||
|
||||
for (int page = 0; page < pages - 1; page++)
|
||||
{
|
||||
if (GetPtEntry((long)address) + PageSize != GetPtEntry((long)address + PageSize))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
address += PageSize;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void WriteSByte(long position, sbyte value)
|
||||
{
|
||||
WriteByte(position, (byte)value);
|
||||
|
|
|
@ -632,7 +632,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
dstOffset,
|
||||
(int)size);
|
||||
|
||||
dstBuffer.Flush(dstAddress, size);
|
||||
// dstBuffer.Flush(dstAddress, size);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
/// <returns>The data at the specified memory location</returns>
|
||||
public Span<byte> Read(ulong address, ulong size)
|
||||
{
|
||||
return _cpuMemory.ReadBytes((long)address, (long)size);
|
||||
return _cpuMemory.GetSpan(address, size);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -154,7 +154,7 @@ namespace Ryujinx.Graphics.Gpu
|
|||
{
|
||||
_context.Methods.PerformDeferredDraws();
|
||||
|
||||
_context.Renderer.FlushPipelines();
|
||||
// _context.Renderer.FlushPipelines();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue