From e58b540c4e2a8df460e0e357e3f341842dd59a71 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Tue, 31 Dec 2019 00:22:58 -0300 Subject: Add XML documentation to Ryujinx.Graphics.Gpu.Memory --- Ryujinx.Graphics.Gpu/Memory/MemoryAccessor.cs | 35 +++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'Ryujinx.Graphics.Gpu/Memory/MemoryAccessor.cs') 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 { + /// + /// GPU mapped memory accessor. + /// class MemoryAccessor { private GpuContext _context; + /// + /// Creates a new instance of the GPU memory accessor. + /// + /// GPU context that the memory accessor belongs to public MemoryAccessor(GpuContext context) { _context = context; } + /// + /// Reads data from GPU mapped memory. + /// This reads as much data as possible, up to the specified maximum size. + /// + /// GPU virtual address where the data is located + /// Maximum size of the data + /// The data at the specified memory location public Span 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); } + /// + /// Reads a structure from GPU mapped memory. + /// + /// Type of the structure + /// GPU virtual address where the strcture is located + /// The structure at the specified memory location public T Read(ulong gpuVa) where T : struct { ulong processVa = _context.MemoryManager.Translate(gpuVa); @@ -30,6 +50,11 @@ namespace Ryujinx.Graphics.Gpu.Memory return MemoryMarshal.Cast(_context.PhysicalMemory.Read(processVa, size))[0]; } + /// + /// Reads a 32-bits signed integer from GPU mapped memory. + /// + /// GPU virtual address where the value is located + /// The value at the specified memory location 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)); } + /// + /// Writes a 32-bits signed integer to GPU mapped memory. + /// + /// GPU virtual address to write the value into + /// The value to be written 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)); } + /// + /// Writes data to GPU mapped memory. + /// + /// GPU virtual address to write the data into + /// The data to be written public void Write(ulong gpuVa, Span data) { ulong processVa = _context.MemoryManager.Translate(gpuVa); -- cgit v1.2.3