aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Image/Pool.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image/Pool.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Image/Pool.cs19
1 files changed, 14 insertions, 5 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/Pool.cs b/Ryujinx.Graphics.Gpu/Image/Pool.cs
index 0b4c2993..a06a7ccf 100644
--- a/Ryujinx.Graphics.Gpu/Image/Pool.cs
+++ b/Ryujinx.Graphics.Gpu/Image/Pool.cs
@@ -1,4 +1,5 @@
using Ryujinx.Cpu.Tracking;
+using Ryujinx.Graphics.Gpu.Memory;
using System;
namespace Ryujinx.Graphics.Gpu.Image
@@ -13,6 +14,7 @@ namespace Ryujinx.Graphics.Gpu.Image
protected const int DescriptorSize = 0x20;
protected GpuContext Context;
+ protected PhysicalMemory PhysicalMemory;
protected T1[] Items;
protected T2[] DescriptorCache;
@@ -38,9 +40,17 @@ namespace Ryujinx.Graphics.Gpu.Image
private readonly CpuMultiRegionHandle _memoryTracking;
private readonly Action<ulong, ulong> _modifiedDelegate;
- public Pool(GpuContext context, ulong address, int maximumId)
+ /// <summary>
+ /// Creates a new instance of the GPU resource pool.
+ /// </summary>
+ /// <param name="context">GPU context that the pool belongs to</param>
+ /// <param name="physicalMemory">Physical memory where the resource descriptors are mapped</param>
+ /// <param name="address">Address of the pool in physical memory</param>
+ /// <param name="maximumId">Maximum index of an item on the pool (inclusive)</param>
+ public Pool(GpuContext context, PhysicalMemory physicalMemory, ulong address, int maximumId)
{
- Context = context;
+ Context = context;
+ PhysicalMemory = physicalMemory;
MaximumId = maximumId;
int count = maximumId + 1;
@@ -53,11 +63,10 @@ namespace Ryujinx.Graphics.Gpu.Image
Address = address;
Size = size;
- _memoryTracking = context.PhysicalMemory.BeginGranularTracking(address, size);
+ _memoryTracking = physicalMemory.BeginGranularTracking(address, size);
_modifiedDelegate = RegionModified;
}
-
/// <summary>
/// Gets the descriptor for a given ID.
/// </summary>
@@ -65,7 +74,7 @@ namespace Ryujinx.Graphics.Gpu.Image
/// <returns>The descriptor</returns>
public T2 GetDescriptor(int id)
{
- return Context.PhysicalMemory.Read<T2>(Address + (ulong)id * DescriptorSize);
+ return PhysicalMemory.Read<T2>(Address + (ulong)id * DescriptorSize);
}
/// <summary>