2021-01-17 10:44:34 -08:00
|
|
|
|
using Ryujinx.Cpu.Tracking;
|
|
|
|
|
using Ryujinx.Memory.Tracking;
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace Ryujinx.Graphics.Gpu.Memory
|
|
|
|
|
{
|
|
|
|
|
class GpuRegionHandle : IRegionHandle
|
|
|
|
|
{
|
|
|
|
|
private readonly CpuRegionHandle[] _cpuRegionHandles;
|
|
|
|
|
|
|
|
|
|
public bool Dirty
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
foreach (var regionHandle in _cpuRegionHandles)
|
|
|
|
|
{
|
|
|
|
|
if (regionHandle.Dirty)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ulong Address => throw new NotSupportedException();
|
|
|
|
|
public ulong Size => throw new NotSupportedException();
|
|
|
|
|
public ulong EndAddress => throw new NotSupportedException();
|
|
|
|
|
|
|
|
|
|
public GpuRegionHandle(CpuRegionHandle[] cpuRegionHandles)
|
|
|
|
|
{
|
|
|
|
|
_cpuRegionHandles = cpuRegionHandles;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
|
{
|
|
|
|
|
foreach (var regionHandle in _cpuRegionHandles)
|
|
|
|
|
{
|
|
|
|
|
regionHandle.Dispose();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RegisterAction(RegionSignal action)
|
|
|
|
|
{
|
|
|
|
|
foreach (var regionHandle in _cpuRegionHandles)
|
|
|
|
|
{
|
|
|
|
|
regionHandle.RegisterAction(action);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-02 14:30:54 -08:00
|
|
|
|
public void Reprotect(bool asDirty = false)
|
2021-01-17 10:44:34 -08:00
|
|
|
|
{
|
|
|
|
|
foreach (var regionHandle in _cpuRegionHandles)
|
|
|
|
|
{
|
2021-03-02 14:30:54 -08:00
|
|
|
|
regionHandle.Reprotect(asDirty);
|
2021-01-17 10:44:34 -08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|