diff options
| author | riperiperi <rhy3756547@hotmail.com> | 2024-03-14 22:38:27 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-14 19:38:27 -0300 |
| commit | fdd3263e31f8bf352a21e05703d0a6a82c800995 (patch) | |
| tree | 24859502db57a2febaa5ab4c7d968d7375156079 /src/Ryujinx.Graphics.Gpu | |
| parent | ce607db944beb352065107830769d8570f0c245e (diff) | |
Separate guest/host tracking + unaligned protection (#6486)
* WIP: Separate guest/host tracking + unaligned protection
Allow memory manager to define support for single byte guest tracking
* Formatting
* Improve docs
* Properly handle cases where the address space bits are too low
* Address feedback
Diffstat (limited to 'src/Ryujinx.Graphics.Gpu')
| -rw-r--r-- | src/Ryujinx.Graphics.Gpu/Image/Pool.cs | 2 | ||||
| -rw-r--r-- | src/Ryujinx.Graphics.Gpu/Memory/Buffer.cs | 4 | ||||
| -rw-r--r-- | src/Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs | 16 |
3 files changed, 15 insertions, 7 deletions
diff --git a/src/Ryujinx.Graphics.Gpu/Image/Pool.cs b/src/Ryujinx.Graphics.Gpu/Image/Pool.cs index 0c3a219d..6ede0197 100644 --- a/src/Ryujinx.Graphics.Gpu/Image/Pool.cs +++ b/src/Ryujinx.Graphics.Gpu/Image/Pool.cs @@ -69,7 +69,7 @@ namespace Ryujinx.Graphics.Gpu.Image Address = address; Size = size; - _memoryTracking = physicalMemory.BeginGranularTracking(address, size, ResourceKind.Pool); + _memoryTracking = physicalMemory.BeginGranularTracking(address, size, ResourceKind.Pool, RegionFlags.None); _memoryTracking.RegisterPreciseAction(address, size, PreciseAction); _modifiedDelegate = RegionModified; } diff --git a/src/Ryujinx.Graphics.Gpu/Memory/Buffer.cs b/src/Ryujinx.Graphics.Gpu/Memory/Buffer.cs index e01e5142..d293060b 100644 --- a/src/Ryujinx.Graphics.Gpu/Memory/Buffer.cs +++ b/src/Ryujinx.Graphics.Gpu/Memory/Buffer.cs @@ -128,13 +128,13 @@ namespace Ryujinx.Graphics.Gpu.Memory if (_useGranular) { - _memoryTrackingGranular = physicalMemory.BeginGranularTracking(address, size, ResourceKind.Buffer, baseHandles); + _memoryTrackingGranular = physicalMemory.BeginGranularTracking(address, size, ResourceKind.Buffer, RegionFlags.UnalignedAccess, baseHandles); _memoryTrackingGranular.RegisterPreciseAction(address, size, PreciseAction); } else { - _memoryTracking = physicalMemory.BeginTracking(address, size, ResourceKind.Buffer); + _memoryTracking = physicalMemory.BeginTracking(address, size, ResourceKind.Buffer, RegionFlags.UnalignedAccess); if (baseHandles != null) { diff --git a/src/Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs b/src/Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs index 69a3054a..cca02bb1 100644 --- a/src/Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs +++ b/src/Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs @@ -368,10 +368,11 @@ namespace Ryujinx.Graphics.Gpu.Memory /// <param name="address">CPU virtual address of the region</param> /// <param name="size">Size of the region</param> /// <param name="kind">Kind of the resource being tracked</param> + /// <param name="flags">Region flags</param> /// <returns>The memory tracking handle</returns> - public RegionHandle BeginTracking(ulong address, ulong size, ResourceKind kind) + public RegionHandle BeginTracking(ulong address, ulong size, ResourceKind kind, RegionFlags flags = RegionFlags.None) { - return _cpuMemory.BeginTracking(address, size, (int)kind); + return _cpuMemory.BeginTracking(address, size, (int)kind, flags); } /// <summary> @@ -408,12 +409,19 @@ namespace Ryujinx.Graphics.Gpu.Memory /// <param name="address">CPU virtual address of the region</param> /// <param name="size">Size of the region</param> /// <param name="kind">Kind of the resource being tracked</param> + /// <param name="flags">Region flags</param> /// <param name="handles">Handles to inherit state from or reuse</param> /// <param name="granularity">Desired granularity of write tracking</param> /// <returns>The memory tracking handle</returns> - public MultiRegionHandle BeginGranularTracking(ulong address, ulong size, ResourceKind kind, IEnumerable<IRegionHandle> handles = null, ulong granularity = 4096) + public MultiRegionHandle BeginGranularTracking( + ulong address, + ulong size, + ResourceKind kind, + RegionFlags flags = RegionFlags.None, + IEnumerable<IRegionHandle> handles = null, + ulong granularity = 4096) { - return _cpuMemory.BeginGranularTracking(address, size, handles, granularity, (int)kind); + return _cpuMemory.BeginGranularTracking(address, size, handles, granularity, (int)kind, flags); } /// <summary> |
