diff options
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Memory/GpuRegionHandle.cs')
-rw-r--r-- | Ryujinx.Graphics.Gpu/Memory/GpuRegionHandle.cs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Gpu/Memory/GpuRegionHandle.cs b/Ryujinx.Graphics.Gpu/Memory/GpuRegionHandle.cs index 8a9c6767..bc07bfad 100644 --- a/Ryujinx.Graphics.Gpu/Memory/GpuRegionHandle.cs +++ b/Ryujinx.Graphics.Gpu/Memory/GpuRegionHandle.cs @@ -4,6 +4,9 @@ using System; namespace Ryujinx.Graphics.Gpu.Memory { + /// <summary> + /// A tracking handle for a region of GPU VA, represented by one or more tracking handles in CPU VA. + /// </summary> class GpuRegionHandle : IRegionHandle { private readonly CpuRegionHandle[] _cpuRegionHandles; @@ -28,11 +31,18 @@ namespace Ryujinx.Graphics.Gpu.Memory public ulong Size => throw new NotSupportedException(); public ulong EndAddress => throw new NotSupportedException(); + /// <summary> + /// Create a new GpuRegionHandle, made up of mulitple CpuRegionHandles. + /// </summary> + /// <param name="cpuRegionHandles">The CpuRegionHandles that make up this handle</param> public GpuRegionHandle(CpuRegionHandle[] cpuRegionHandles) { _cpuRegionHandles = cpuRegionHandles; } + /// <summary> + /// Dispose the child handles. + /// </summary> public void Dispose() { foreach (var regionHandle in _cpuRegionHandles) @@ -41,6 +51,11 @@ namespace Ryujinx.Graphics.Gpu.Memory } } + /// <summary> + /// Register an action to perform when the tracked region is read or written. + /// The action is automatically removed after it runs. + /// </summary> + /// <param name="action">Action to call on read or write</param> public void RegisterAction(RegionSignal action) { foreach (var regionHandle in _cpuRegionHandles) @@ -49,6 +64,22 @@ namespace Ryujinx.Graphics.Gpu.Memory } } + /// <summary> + /// Register an action to perform when a precise access occurs (one with exact address and size). + /// If the action returns true, read/write tracking are skipped. + /// </summary> + /// <param name="action">Action to call on read or write</param> + public void RegisterPreciseAction(PreciseRegionSignal action) + { + foreach (var regionHandle in _cpuRegionHandles) + { + regionHandle.RegisterPreciseAction(action); + } + } + + /// <summary> + /// Consume the dirty flag for the handles, and reprotect so it can be set on the next write. + /// </summary> public void Reprotect(bool asDirty = false) { foreach (var regionHandle in _cpuRegionHandles) @@ -57,6 +88,9 @@ namespace Ryujinx.Graphics.Gpu.Memory } } + /// <summary> + /// Force the handles to be dirty, without reprotecting. + /// </summary> public void ForceDirty() { foreach (var regionHandle in _cpuRegionHandles) |