aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Memory/MemoryAccessor.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2019-12-31 00:22:58 -0300
committerThog <thog@protonmail.com>2020-01-09 02:13:00 +0100
commite58b540c4e2a8df460e0e357e3f341842dd59a71 (patch)
tree7bb4aa70e991b648a869bd9e0875d230d9579a62 /Ryujinx.Graphics.Gpu/Memory/MemoryAccessor.cs
parent80ff2eab2992a3373ee79475d891ef126d67a4a2 (diff)
Add XML documentation to Ryujinx.Graphics.Gpu.Memory
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Memory/MemoryAccessor.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Memory/MemoryAccessor.cs35
1 files changed, 35 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Gpu/Memory/MemoryAccessor.cs b/Ryujinx.Graphics.Gpu/Memory/MemoryAccessor.cs
index 500c36e5..a0247acf 100644
--- a/Ryujinx.Graphics.Gpu/Memory/MemoryAccessor.cs
+++ b/Ryujinx.Graphics.Gpu/Memory/MemoryAccessor.cs
@@ -3,15 +3,29 @@ using System.Runtime.InteropServices;
namespace Ryujinx.Graphics.Gpu.Memory
{
+ /// <summary>
+ /// GPU mapped memory accessor.
+ /// </summary>
class MemoryAccessor
{
private GpuContext _context;
+ /// <summary>
+ /// Creates a new instance of the GPU memory accessor.
+ /// </summary>
+ /// <param name="context">GPU context that the memory accessor belongs to</param>
public MemoryAccessor(GpuContext context)
{
_context = context;
}
+ /// <summary>
+ /// Reads data from GPU mapped memory.
+ /// This reads as much data as possible, up to the specified maximum size.
+ /// </summary>
+ /// <param name="gpuVa">GPU virtual address where the data is located</param>
+ /// <param name="maxSize">Maximum size of the data</param>
+ /// <returns>The data at the specified memory location</returns>
public Span<byte> Read(ulong gpuVa, ulong maxSize)
{
ulong processVa = _context.MemoryManager.Translate(gpuVa);
@@ -21,6 +35,12 @@ namespace Ryujinx.Graphics.Gpu.Memory
return _context.PhysicalMemory.Read(processVa, size);
}
+ /// <summary>
+ /// Reads a structure from GPU mapped memory.
+ /// </summary>
+ /// <typeparam name="T">Type of the structure</typeparam>
+ /// <param name="gpuVa">GPU virtual address where the strcture is located</param>
+ /// <returns>The structure at the specified memory location</returns>
public T Read<T>(ulong gpuVa) where T : struct
{
ulong processVa = _context.MemoryManager.Translate(gpuVa);
@@ -30,6 +50,11 @@ namespace Ryujinx.Graphics.Gpu.Memory
return MemoryMarshal.Cast<byte, T>(_context.PhysicalMemory.Read(processVa, size))[0];
}
+ /// <summary>
+ /// Reads a 32-bits signed 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 int ReadInt32(ulong gpuVa)
{
ulong processVa = _context.MemoryManager.Translate(gpuVa);
@@ -37,6 +62,11 @@ namespace Ryujinx.Graphics.Gpu.Memory
return BitConverter.ToInt32(_context.PhysicalMemory.Read(processVa, 4));
}
+ /// <summary>
+ /// Writes a 32-bits signed integer to GPU mapped memory.
+ /// </summary>
+ /// <param name="gpuVa">GPU virtual address to write the value into</param>
+ /// <param name="value">The value to be written</param>
public void Write(ulong gpuVa, int value)
{
ulong processVa = _context.MemoryManager.Translate(gpuVa);
@@ -44,6 +74,11 @@ namespace Ryujinx.Graphics.Gpu.Memory
_context.PhysicalMemory.Write(processVa, BitConverter.GetBytes(value));
}
+ /// <summary>
+ /// Writes data to GPU mapped memory.
+ /// </summary>
+ /// <param name="gpuVa">GPU virtual address to write the data into</param>
+ /// <param name="data">The data to be written</param>
public void Write(ulong gpuVa, Span<byte> data)
{
ulong processVa = _context.MemoryManager.Translate(gpuVa);