Initial support for GPU channels (#2372)
* Ground work for separate GPU channels * Rename TextureManager to TextureCache * Decouple texture bindings management from the texture cache * Rename BufferManager to BufferCache * Decouple buffer bindings management from the buffer cache * More comments and proper disposal * PR feedback * Force host state update on channel switch * Typo * PR feedback * Missing using
This commit is contained in:
parent
12a7a2ead8
commit
a10b2c5ff2
24 changed files with 1745 additions and 1456 deletions
|
@ -72,6 +72,11 @@ namespace Ryujinx.Graphics.Gpu
|
|||
/// </summary>
|
||||
internal List<Action> SyncActions { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Queue with closed channels for deferred disposal from the render thread.
|
||||
/// </summary>
|
||||
internal Queue<GpuChannel> DisposedChannels { get; }
|
||||
|
||||
private readonly Lazy<Capabilities> _caps;
|
||||
|
||||
/// <summary>
|
||||
|
@ -111,6 +116,13 @@ namespace Ryujinx.Graphics.Gpu
|
|||
HostInitalized = new ManualResetEvent(false);
|
||||
|
||||
SyncActions = new List<Action>();
|
||||
|
||||
DisposedChannels = new Queue<GpuChannel>();
|
||||
}
|
||||
|
||||
public GpuChannel CreateChannel()
|
||||
{
|
||||
return new GpuChannel(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -173,6 +185,18 @@ namespace Ryujinx.Graphics.Gpu
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs deferred disposal of closed channels.
|
||||
/// This must only be called from the render thread.
|
||||
/// </summary>
|
||||
internal void DisposePendingChannels()
|
||||
{
|
||||
while (DisposedChannels.TryDequeue(out GpuChannel channel))
|
||||
{
|
||||
channel.Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disposes all GPU resources currently cached.
|
||||
/// It's an error to push any GPU commands after disposal.
|
||||
|
@ -181,9 +205,10 @@ namespace Ryujinx.Graphics.Gpu
|
|||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
DisposePendingChannels();
|
||||
Methods.ShaderCache.Dispose();
|
||||
Methods.BufferManager.Dispose();
|
||||
Methods.TextureManager.Dispose();
|
||||
Methods.BufferCache.Dispose();
|
||||
Methods.TextureCache.Dispose();
|
||||
Renderer.Dispose();
|
||||
GPFifo.Dispose();
|
||||
HostInitalized.Dispose();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue