mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-06-30 02:06:25 +02:00
GPU: Pre-emptively flush textures that are flushed often (to imported memory when available) (#4711)
* WIP texture pre-flush Improve performance of TextureView GetData to buffer Fix copy/sync ordering Fix minor bug Make this actually work WIP host mapping stuff * Fix usage flags * message * Cleanup 1 * Fix rebase * Fix * Improve pre-flush rules * Fix pre-flush * A lot of cleanup * Use the host memory bits * Select the correct memory type * Cleanup TextureGroupHandle * Missing comment * Remove debugging logs * Revert BufferHandle _value access modifier * One interrupt action at a time. * Support D32S8 to D24S8 conversion, safeguards * Interrupt cannot happen in sync handle's lock Waitable needs to be checked twice now, but this should stop it from deadlocking. * Remove unused using * Address some feedback * Address feedback * Address more feedback * Address more feedback * Improve sync rules Should allow for faster sync in some cases.
This commit is contained in:
parent
36f10df775
commit
e18d258fa0
40 changed files with 1328 additions and 79 deletions
|
@ -60,14 +60,14 @@ namespace Ryujinx.Graphics.Gpu
|
|||
/// If there are more than 0 items when this happens, a host sync object will be generated for the given <see cref="SyncNumber"/>,
|
||||
/// and the SyncNumber will be incremented.
|
||||
/// </summary>
|
||||
internal List<Action> SyncActions { get; }
|
||||
internal List<ISyncActionHandler> SyncActions { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Actions to be performed when a CPU waiting syncpoint is triggered.
|
||||
/// If there are more than 0 items when this happens, a host sync object will be generated for the given <see cref="SyncNumber"/>,
|
||||
/// and the SyncNumber will be incremented.
|
||||
/// </summary>
|
||||
internal List<Action> SyncpointActions { get; }
|
||||
internal List<ISyncActionHandler> SyncpointActions { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Buffer migrations that are currently in-flight. These are checked whenever sync is created to determine if buffer migration
|
||||
|
@ -114,8 +114,8 @@ namespace Ryujinx.Graphics.Gpu
|
|||
|
||||
HostInitalized = new ManualResetEvent(false);
|
||||
|
||||
SyncActions = new List<Action>();
|
||||
SyncpointActions = new List<Action>();
|
||||
SyncActions = new List<ISyncActionHandler>();
|
||||
SyncpointActions = new List<ISyncActionHandler>();
|
||||
BufferMigrations = new List<BufferMigration>();
|
||||
|
||||
DeferredActions = new Queue<Action>();
|
||||
|
@ -296,9 +296,9 @@ namespace Ryujinx.Graphics.Gpu
|
|||
/// Registers an action to be performed the next time a syncpoint is incremented.
|
||||
/// This will also ensure a host sync object is created, and <see cref="SyncNumber"/> is incremented.
|
||||
/// </summary>
|
||||
/// <param name="action">The action to be performed on sync object creation</param>
|
||||
/// <param name="action">The resource with action to be performed on sync object creation</param>
|
||||
/// <param name="syncpointOnly">True if the sync action should only run when syncpoints are incremented</param>
|
||||
public void RegisterSyncAction(Action action, bool syncpointOnly = false)
|
||||
internal void RegisterSyncAction(ISyncActionHandler action, bool syncpointOnly = false)
|
||||
{
|
||||
if (syncpointOnly)
|
||||
{
|
||||
|
@ -315,10 +315,13 @@ namespace Ryujinx.Graphics.Gpu
|
|||
/// Creates a host sync object if there are any pending sync actions. The actions will then be called.
|
||||
/// If no actions are present, a host sync object is not created.
|
||||
/// </summary>
|
||||
/// <param name="syncpoint">True if host sync is being created by a syncpoint</param>
|
||||
/// <param name="strict">True if the sync should signal as soon as possible</param>
|
||||
public void CreateHostSyncIfNeeded(bool syncpoint, bool strict)
|
||||
/// <param name="flags">Modifiers for how host sync should be created</param>
|
||||
internal void CreateHostSyncIfNeeded(HostSyncFlags flags)
|
||||
{
|
||||
bool syncpoint = flags.HasFlag(HostSyncFlags.Syncpoint);
|
||||
bool strict = flags.HasFlag(HostSyncFlags.Strict);
|
||||
bool force = flags.HasFlag(HostSyncFlags.Force);
|
||||
|
||||
if (BufferMigrations.Count > 0)
|
||||
{
|
||||
ulong currentSyncNumber = Renderer.GetCurrentSync();
|
||||
|
@ -336,24 +339,17 @@ namespace Ryujinx.Graphics.Gpu
|
|||
}
|
||||
}
|
||||
|
||||
if (_pendingSync || (syncpoint && SyncpointActions.Count > 0))
|
||||
if (force || _pendingSync || (syncpoint && SyncpointActions.Count > 0))
|
||||
{
|
||||
Renderer.CreateSync(SyncNumber, strict);
|
||||
|
||||
SyncActions.ForEach(action => action.SyncPreAction(syncpoint));
|
||||
SyncpointActions.ForEach(action => action.SyncPreAction(syncpoint));
|
||||
|
||||
SyncNumber++;
|
||||
|
||||
foreach (Action action in SyncActions)
|
||||
{
|
||||
action();
|
||||
}
|
||||
|
||||
foreach (Action action in SyncpointActions)
|
||||
{
|
||||
action();
|
||||
}
|
||||
|
||||
SyncActions.Clear();
|
||||
SyncpointActions.Clear();
|
||||
SyncActions.RemoveAll(action => action.SyncAction(syncpoint));
|
||||
SyncpointActions.RemoveAll(action => action.SyncAction(syncpoint));
|
||||
}
|
||||
|
||||
_pendingSync = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue