From fbb4019ed5c12c4a888c7b09db648ac595366896 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Tue, 29 Jun 2021 14:32:02 -0300 Subject: 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 --- Ryujinx.Graphics.Gpu/Image/TexturePoolCache.cs | 27 ++++++-------------------- 1 file changed, 6 insertions(+), 21 deletions(-) (limited to 'Ryujinx.Graphics.Gpu/Image/TexturePoolCache.cs') diff --git a/Ryujinx.Graphics.Gpu/Image/TexturePoolCache.cs b/Ryujinx.Graphics.Gpu/Image/TexturePoolCache.cs index c9eebf8b..99c5a88b 100644 --- a/Ryujinx.Graphics.Gpu/Image/TexturePoolCache.cs +++ b/Ryujinx.Graphics.Gpu/Image/TexturePoolCache.cs @@ -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. /// - class TexturePoolCache : IDisposable + class TexturePoolCache { private const int MaxCapacity = 4; - private GpuContext _context; - - private LinkedList _pools; + private readonly GpuContext _context; + private readonly LinkedList _pools; /// /// 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(); } /// /// Finds a cache texture pool, or creates a new one if not found. /// + /// GPU channel that the texture pool cache belongs to /// Start address of the texture pool /// Maximum ID of the texture pool /// The found or newly created texture pool - 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; } - - /// - /// Disposes the texture pool cache. - /// It's an error to use the texture pool cache after disposal. - /// - public void Dispose() - { - foreach (TexturePool pool in _pools) - { - pool.Dispose(); - } - - _pools.Clear(); - } } } \ No newline at end of file -- cgit v1.2.3