Re-add NVDEC project (not integrated)
This commit is contained in:
parent
6e092c0558
commit
0dbfe3c23e
31 changed files with 2547 additions and 18 deletions
|
@ -6,7 +6,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
/// <summary>
|
||||
/// GPU mapped memory accessor.
|
||||
/// </summary>
|
||||
class MemoryAccessor
|
||||
public class MemoryAccessor
|
||||
{
|
||||
private GpuContext _context;
|
||||
|
||||
|
@ -19,6 +19,17 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
_context = context;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads a byte array from GPU mapped memory.
|
||||
/// </summary>
|
||||
/// <param name="gpuVa">GPU virtual address where the data is located</param>
|
||||
/// <param name="size">Size of the data in bytes</param>
|
||||
/// <returns>Byte array with the data</returns>
|
||||
public byte[] ReadBytes(ulong gpuVa, ulong size)
|
||||
{
|
||||
return Read(gpuVa, size).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads data from GPU mapped memory.
|
||||
/// This reads as much data as possible, up to the specified maximum size.
|
||||
|
@ -62,6 +73,30 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
return BitConverter.ToInt32(_context.PhysicalMemory.Read(processVa, 4));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads a 64-bits unsigned integer from GPU mapped memory.
|
||||
/// </summary>
|
||||
/// <param name="gpuVa">GPU virtual address where the value is located</param>
|
||||
/// <returns>The value at the specified memory location</returns>
|
||||
public ulong ReadUInt64(ulong gpuVa)
|
||||
{
|
||||
ulong processVa = _context.MemoryManager.Translate(gpuVa);
|
||||
|
||||
return BitConverter.ToUInt64(_context.PhysicalMemory.Read(processVa, 8));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads a 8-bits unsigned integer from GPU mapped memory.
|
||||
/// </summary>
|
||||
/// <param name="gpuVa">GPU virtual address where the value is located</param>
|
||||
/// <param name="value">The value to be written</param>
|
||||
public void WriteByte(ulong gpuVa, byte value)
|
||||
{
|
||||
ulong processVa = _context.MemoryManager.Translate(gpuVa);
|
||||
|
||||
_context.PhysicalMemory.Write(processVa, MemoryMarshal.CreateSpan(ref value, 1));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes a 32-bits signed integer to GPU mapped memory.
|
||||
/// </summary>
|
||||
|
|
|
@ -252,7 +252,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
/// </summary>
|
||||
/// <param name="gpuVa">GPU virtual address to be translated</param>
|
||||
/// <returns>CPU virtual address</returns>
|
||||
internal ulong Translate(ulong gpuVa)
|
||||
public ulong Translate(ulong gpuVa)
|
||||
{
|
||||
ulong baseAddress = GetPte(gpuVa);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue