Initial support for separate GPU address spaces (#2394)
* Make GPU memory manager a member of GPU channel * Move physical memory instance to the memory manager, and the caches to the physical memory * PR feedback
This commit is contained in:
parent
8cc872fb60
commit
fbb4019ed5
44 changed files with 780 additions and 481 deletions
|
@ -8,13 +8,12 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
/// This can keep multiple texture pools, and return the current one as needed.
|
||||
/// It is useful for applications that uses multiple texture pools.
|
||||
/// </summary>
|
||||
class TexturePoolCache : IDisposable
|
||||
class TexturePoolCache
|
||||
{
|
||||
private const int MaxCapacity = 4;
|
||||
|
||||
private GpuContext _context;
|
||||
|
||||
private LinkedList<TexturePool> _pools;
|
||||
private readonly GpuContext _context;
|
||||
private readonly LinkedList<TexturePool> _pools;
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new instance of the texture pool.
|
||||
|
@ -23,17 +22,17 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
public TexturePoolCache(GpuContext context)
|
||||
{
|
||||
_context = context;
|
||||
|
||||
_pools = new LinkedList<TexturePool>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds a cache texture pool, or creates a new one if not found.
|
||||
/// </summary>
|
||||
/// <param name="channel">GPU channel that the texture pool cache belongs to</param>
|
||||
/// <param name="address">Start address of the texture pool</param>
|
||||
/// <param name="maximumId">Maximum ID of the texture pool</param>
|
||||
/// <returns>The found or newly created texture pool</returns>
|
||||
public TexturePool FindOrCreate(ulong address, int maximumId)
|
||||
public TexturePool FindOrCreate(GpuChannel channel, ulong address, int maximumId)
|
||||
{
|
||||
TexturePool pool;
|
||||
|
||||
|
@ -56,7 +55,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
}
|
||||
|
||||
// If not found, create a new one.
|
||||
pool = new TexturePool(_context, address, maximumId);
|
||||
pool = new TexturePool(_context, channel, address, maximumId);
|
||||
|
||||
pool.CacheNode = _pools.AddLast(pool);
|
||||
|
||||
|
@ -73,19 +72,5 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
|
||||
return pool;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disposes the texture pool cache.
|
||||
/// It's an error to use the texture pool cache after disposal.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
foreach (TexturePool pool in _pools)
|
||||
{
|
||||
pool.Dispose();
|
||||
}
|
||||
|
||||
_pools.Clear();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue